1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
// RUN: %batch-code-completion
struct MyStruct {
init() {}
var value: Int
}
// MEMBER_MyStruct: Begin completions, 2 items
// MEMBER_MyStruct-DAG: Keyword[self]/CurrNominal: self[#MyStruct#];
// MEMBER_MyStruct-DAG: Decl[InstanceVar]/CurrNominal: value[#Int#];
#if true
let toplevelActive = MyStruct()
_ = toplevelActive.#^MEMBER_TOPLEVEL_ACTIVE?check=MEMBER_MyStruct^#
#else
let toplevelInactive = MyStruct()
_ = toplevelInactive.#^MEMBER_TOPLEVEL_INACTIVE?check=MEMBER_MyStruct^#
#endif
func foo() {
#if true
let infuncActive = MyStruct()
_ = infuncActive.#^MEMBER_INFUNC_ACTIVE?check=MEMBER_MyStruct^#
#else
let infuncInactive = MyStruct()
_ = infuncInactive.#^MEMBER_INFUNC_INACTIVE?check=MEMBER_MyStruct^#
#endif
}
protocol TestP {
func foo()
func bar()
}
struct TestStruct: TestP {
#if true
func foo() {}
func #^OVERRIDE_ACTIVE^#
// OVERRIDE_ACTIVE: Begin completions, 1 items
// OVERRIDE_ACTIVE-DAG: Decl[InstanceMethod]/Super: bar() {|};
#else
func bar() {}
func #^OVERRIDE_INACTIVE^#
// OVERRIDE_INACTIVE: Begin completions, 1 items
// OVERRIDE_INACTIVE-DAG: Decl[InstanceMethod]/Super: foo() {|};
#endif
}
struct TestStruct2 {
#if true
func activeFunc() {}
func test() {
self.#^SELF_ACTIVE^#
}
// SELF_ACTIVE: Begin completions, 3 items
// SELF_ACTIVE-DAG: Keyword[self]/CurrNominal: self[#TestStruct2#];
// SELF_ACTIVE-DAG: Decl[InstanceMethod]/CurrNominal: activeFunc()[#Void#];
// SELF_ACTIVE-DAG: Decl[InstanceMethod]/CurrNominal: test()[#Void#];
#else
func inactiveFunc() {}
func test() {
self.#^SELF_INACTIVE^#
}
// SELF_INACTIVE: Begin completions, 3 items
// SELF_INACTIVE-DAG: Keyword[self]/CurrNominal: self[#TestStruct2#];
// SELF_INACTIVE-DAG: Decl[InstanceMethod]/CurrNominal: inactiveFunc()[#Void#];
// SELF_INACTIVE-DAG: Decl[InstanceMethod]/CurrNominal: test()[#Void#];
#endif
}
|