|
| 1 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_VAR_INIT | %FileCheck %s -check-prefix=STRUCT_STATIC |
| 2 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_VAR_INIT | %FileCheck %s -check-prefix=STRUCT_STATIC |
| 3 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_LAZY_VAR_INIT | %FileCheck %s -check-prefix=STRUCT_INSTANCE |
| 4 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_VAR_BODY | %FileCheck %s -check-prefix=STRUCT_INSTANCE |
| 5 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_VAR_BODY | %FileCheck %s -check-prefix=STRUCT_STATIC |
| 6 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INITIALIZER_DEFAULTPARAM | %FileCheck %s -check-prefix=STRUCT_STATIC |
| 7 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INITIALIZER_BODY | %FileCheck %s -check-prefix=STRUCT_INSTANCE |
| 8 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_FUNC_DEFAULTPARAM | %FileCheck %s -check-prefix=STRUCT_STATIC |
| 9 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_FUNC_BODY | %FileCheck %s -check-prefix=STRUCT_INSTANCE |
| 10 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_FUNC_DEFAULTPARAM | %FileCheck %s -check-prefix=STRUCT_STATIC |
| 11 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_FUNC_BODY | %FileCheck %s -check-prefix=STRUCT_STATIC |
| 12 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_SUBSCRIPT_DEFAULTPARAM | %FileCheck %s -check-prefix=STRUCT_STATIC |
| 13 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE_SUBSCRIPT_BODY | %FileCheck %s -check-prefix=STRUCT_INSTANCE |
| 14 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_SUBSCRIPT_DEFAULTPARAM | %FileCheck %s -check-prefix=STRUCT_STATIC |
| 15 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_STATIC_SUBSCRIPT_BODY | %FileCheck %s -check-prefix=STRUCT_STATIC |
| 16 | + |
| 17 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_VAR_INIT | %FileCheck %s -check-prefix=ENUM_STATIC |
| 18 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INSTANCE_VAR_BODY | %FileCheck %s -check-prefix=ENUM_INSTANCE |
| 19 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_VAR_BODY | %FileCheck %s -check-prefix=ENUM_STATIC |
| 20 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INITIALIZER_DEFAULTPARAM | %FileCheck %s -check-prefix=ENUM_STATIC |
| 21 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INITIALIZER_BODY | %FileCheck %s -check-prefix=ENUM_INSTANCE |
| 22 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INSTANCE_FUNC_DEFAULTPARAM | %FileCheck %s -check-prefix=ENUM_STATIC |
| 23 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INSTANCE_FUNC_BODY | %FileCheck %s -check-prefix=ENUM_INSTANCE |
| 24 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_FUNC_DEFAULTPARAM | %FileCheck %s -check-prefix=ENUM_STATIC |
| 25 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_FUNC_BODY | %FileCheck %s -check-prefix=ENUM_STATIC |
| 26 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INSTANCE_SUBSCRIPT_DEFAULTPARAM | %FileCheck %s -check-prefix=ENUM_STATIC |
| 27 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_INSTANCE_SUBSCRIPT_BODY | %FileCheck %s -check-prefix=ENUM_INSTANCE |
| 28 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_SUBSCRIPT_DEFAULTPARAM | %FileCheck %s -check-prefix=ENUM_STATIC |
| 29 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_STATIC_SUBSCRIPT_BODY | %FileCheck %s -check-prefix=ENUM_STATIC |
| 30 | + |
| 31 | + |
| 32 | +// STRUCT_INSTANCE: Begin completions |
| 33 | +// STRUCT_INSTANCE-NOT: init() |
| 34 | +// STRUCT_INSTANCE-NOT: staticVar |
| 35 | +// STRUCT_INSTANCE-NOT: staticFunc |
| 36 | +// STRUCT_INSTANCE-DAG: Decl[InstanceVar]/CurrNominal: instanceVar[#Int#]; |
| 37 | +// STRUCT_INSTANCE-DAG: Decl[InstanceMethod]/CurrNominal: instanceFunc()[#Int#]; |
| 38 | +// STRUCT_INSTANCE-NOT: init() |
| 39 | +// STRUCT_INSTANCE-NOT: staticVar |
| 40 | +// STRUCT_INSTANCE-NOT: staticFunc |
| 41 | +// STRUCT_INSTANCE: End completions |
| 42 | + |
| 43 | +// STRUCT_STATIC: Begin completions |
| 44 | +// STRUCT_STATIC-NOT: init() |
| 45 | +// STRUCT_STATIC-NOT: instanceVar |
| 46 | +// STRUCT_STATIC-DAG: Decl[StaticVar]/CurrNominal: staticVar[#Int#]; |
| 47 | +// STRUCT_STATIC-DAG: Decl[StaticMethod]/CurrNominal: staticFunc()[#Int#]; |
| 48 | +// STRUCT_STATIC-DAG: Decl[InstanceMethod]/CurrNominal: instanceFunc({#(self): MyStruct#})[#() -> Int#]; |
| 49 | +// STRUCT_STATIC-NOT: init() |
| 50 | +// STRUCT_STATIC-NOT: instanceVar |
| 51 | +// STRUCT_STATIC: End completions |
| 52 | + |
| 53 | +struct MyStruct { |
| 54 | + init() { self = MyEnum.east } |
| 55 | + static var staticVar: Int { 1 } |
| 56 | + static func staticFunc() -> Int { 1 } |
| 57 | + var instanceVar: Int { 1 } |
| 58 | + func instanceFunc() -> Int { 1 } |
| 59 | + |
| 60 | + var testInstanceVarInit: String = (#^STRUCT_INSTANCE_VAR_INIT^#) |
| 61 | + static var testStaticVarInit: String = (#^STRUCT_STATIC_VAR_INIT^#) |
| 62 | + lazy var testLazyVarInit: String = (#^STRUCT_LAZY_VAR_INIT^#) |
| 63 | + var testInstanceVar: String { |
| 64 | + #^STRUCT_INSTANCE_VAR_BODY^# |
| 65 | + } |
| 66 | + static var testStaticVar: String { |
| 67 | + #^STRUCT_STATIC_VAR_BODY^# |
| 68 | + } |
| 69 | + init(testInit: String = #^STRUCT_INITIALIZER_DEFAULTPARAM^#) { |
| 70 | + #^STRUCT_INITIALIZER_BODY^# |
| 71 | + } |
| 72 | + func testInstanceMethod(x: String = #^STRUCT_INSTANCE_FUNC_DEFAULTPARAM^#) { |
| 73 | + #^STRUCT_INSTANCE_FUNC_BODY^# |
| 74 | + } |
| 75 | + static func testStaticMethod(x: String = #^STRUCT_STATIC_FUNC_DEFAULTPARAM^#) { |
| 76 | + #^STRUCT_STATIC_FUNC_BODY^# |
| 77 | + } |
| 78 | + subscript(testInstanceSubscript idx: String = #^STRUCT_INSTANCE_SUBSCRIPT_DEFAULTPARAM^#) { |
| 79 | + #^STRUCT_INSTANCE_SUBSCRIPT_BODY^# |
| 80 | + } |
| 81 | + static subscript(testStaticSubscript idx: String = #^STRUCT_STATIC_SUBSCRIPT_DEFAULTPARAM^#) { |
| 82 | + #^STRUCT_STATIC_SUBSCRIPT_BODY^# |
| 83 | + } |
| 84 | +} |
| 85 | + |
| 86 | +// ENUM_INSTANCE: Begin completions |
| 87 | +// ENUM_INSTANCE-NOT: east |
| 88 | +// ENUM_INSTANCE-NOT: west |
| 89 | +// ENUM_INSTANCE-NOT: init() |
| 90 | +// ENUM_INSTANCE-NOT: staticVar |
| 91 | +// ENUM_INSTANCE-NOT: staticFunc |
| 92 | +// ENUM_INSTANCE-DAG: Decl[InstanceVar]/CurrNominal: instanceVar[#Int#]; |
| 93 | +// ENUM_INSTANCE-DAG: Decl[InstanceMethod]/CurrNominal: instanceFunc()[#Int#]; |
| 94 | +// ENUM_INSTANCE-NOT: east |
| 95 | +// ENUM_INSTANCE-NOT: west |
| 96 | +// ENUM_INSTANCE-NOT: init() |
| 97 | +// ENUM_INSTANCE-NOT: staticVar |
| 98 | +// ENUM_INSTANCE-NOT: staticFunc |
| 99 | +// ENUM_INSTANCE: End completions |
| 100 | + |
| 101 | +// ENUM_STATIC: Begin completions |
| 102 | +// ENUM_STATIC-NOT: init() |
| 103 | +// ENUM_STATIC-NOT: instanceVar |
| 104 | +// ENUM_STATIC-DAG: Decl[EnumElement]/CurrNominal: east[#MyEnum#]; |
| 105 | +// ENUM_STATIC-DAG: Decl[EnumElement]/CurrNominal: west[#MyEnum#]; |
| 106 | +// ENUM_STATIC-DAG: Decl[StaticVar]/CurrNominal: staticVar[#Int#]; |
| 107 | +// ENUM_STATIC-DAG: Decl[StaticMethod]/CurrNominal: staticFunc()[#Int#]; |
| 108 | +// ENUM_STATIC-DAG: Decl[InstanceMethod]/CurrNominal: instanceFunc({#(self): MyEnum#})[#() -> Int#]; |
| 109 | +// ENUM_STATIC-NOT: init() |
| 110 | +// ENUM_STATIC-NOT: instanceVar |
| 111 | +// ENUM_STATIC: End completions |
| 112 | + |
| 113 | +enum MyEnum { |
| 114 | + case east, west |
| 115 | + init() { self = MyEnum.east } |
| 116 | + static var staticVar: Int = 1 |
| 117 | + static func staticFunc() -> Int { 1 } |
| 118 | + var instanceVar: Int { 1 } |
| 119 | + func instanceFunc() -> Int { 1 } |
| 120 | + |
| 121 | + static var testStaticVarInit: String = (#^ENUM_STATIC_VAR_INIT^#) |
| 122 | + var testInstanceVar: String { |
| 123 | + #^ENUM_INSTANCE_VAR_BODY^# |
| 124 | + } |
| 125 | + static var testStaticVar: String { |
| 126 | + #^ENUM_STATIC_VAR_BODY^# |
| 127 | + } |
| 128 | + func init(testInit: String = #^ENUM_INITIALIZER_DEFAULTPARAM^#) { |
| 129 | + #^ENUM_INITIALIZER_BODY^# |
| 130 | + } |
| 131 | + func testInstanceMethod(x: String = #^ENUM_INSTANCE_FUNC_DEFAULTPARAM^#) { |
| 132 | + #^ENUM_INSTANCE_FUNC_BODY^# |
| 133 | + } |
| 134 | + static func testStaticMethod(x: String = #^ENUM_STATIC_FUNC_DEFAULTPARAM^#) { |
| 135 | + #^ENUM_STATIC_FUNC_BODY^# |
| 136 | + } |
| 137 | + subscript(testInstanceSubscript idx: String = #^ENUM_INSTANCE_SUBSCRIPT_DEFAULTPARAM^#) { |
| 138 | + #^ENUM_INSTANCE_SUBSCRIPT_BODY^# |
| 139 | + } |
| 140 | + static subscript(testStaticSubscript idx: String = #^ENUM_STATIC_SUBSCRIPT_DEFAULTPARAM^#) { |
| 141 | + #^ENUM_STATIC_SUBSCRIPT_BODY^# |
| 142 | + } |
| 143 | +} |
0 commit comments