|
| 1 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STATIC_PRIMARY | %FileCheck %s -check-prefix=STATIC_PRIMARY |
| 2 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STATIC_SELF_NODOT | %FileCheck %s -check-prefix=STATIC_SELF_NODOT |
| 3 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STATIC_SELF_DOT | %FileCheck %s -check-prefix=STATIC_SELF_DOT |
| 4 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=META_NODOT | %FileCheck %s -check-prefix=STATIC_SELF_NODOT |
| 5 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=META_DOT | %FileCheck %s -check-prefix=STATIC_SELF_DOT |
| 6 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSTANCE_PRIMARY | %FileCheck %s -check-prefix=INSTANCE_PRIMARY |
| 7 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSTANCE_SELF_NODOT | %FileCheck %s -check-prefix=INSTANCE_SELF_NODOT |
| 8 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSTANCE_SELF_DOT | %FileCheck %s -check-prefix=INSTANCE_SELF_DOT |
| 9 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=VALUE_NODOT | %FileCheck %s -check-prefix=INSTANCE_SELF_NODOT |
| 10 | +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=VALUE_DOT | %FileCheck %s -check-prefix=INSTANCE_SELF_DOT |
| 11 | + |
| 12 | + |
| 13 | +enum MyEnum { |
| 14 | + case `class`(struct: String) |
| 15 | + case `let`(`var`: String) |
| 16 | + |
| 17 | + init(`init`: String) {} |
| 18 | + static func `public`(private: String) -> Int {} |
| 19 | + |
| 20 | + func `init`(deinit: String) -> Int {} |
| 21 | + func `if`(else: String) -> Int {} |
| 22 | + |
| 23 | + var `self`: Int { return 0 } |
| 24 | + |
| 25 | + static func testStatic(meta: MyEnum.Type) { |
| 26 | + let _ = #^STATIC_PRIMARY^# |
| 27 | +// STATIC_PRIMARY: Begin completion |
| 28 | +// STATIC_PRIMARY-DAG: Decl[LocalVar]/Local: self[#MyEnum.Type#]; name=self |
| 29 | +// STATIC_PRIMARY-DAG: Decl[EnumElement]/CurrNominal: `class`({#struct: String#})[#MyEnum#]; name=`class`(struct: String) |
| 30 | +// STATIC_PRIMARY-DAG: Decl[EnumElement]/CurrNominal: `let`({#`var`: String#})[#MyEnum#]; name=`let`(`var`: String) |
| 31 | +// STATIC_PRIMARY-DAG: Decl[StaticMethod]/CurrNominal: `public`({#private: String#})[#Int#]; name=`public`(private: String) |
| 32 | +// STATIC_PRIMARY-DAG: Decl[InstanceMethod]/CurrNominal: `init`({#(self): MyEnum#})[#(deinit: String) -> Int#]; name=`init`(self: MyEnum) |
| 33 | +// STATIC_PRIMARY-DAG: Decl[InstanceMethod]/CurrNominal: `if`({#(self): MyEnum#})[#(else: String) -> Int#]; name=`if`(self: MyEnum) |
| 34 | +// STATIC_PRIMARY: End completion |
| 35 | + |
| 36 | + let _ = self#^STATIC_SELF_NODOT^# |
| 37 | +// STATIC_SELF_NODOT: Begin completions |
| 38 | +// STATIC_SELF_NODOT-DAG: Keyword[self]/CurrNominal: .self[#MyEnum.Type#]; name=self |
| 39 | +// STATIC_SELF_NODOT-DAG: Decl[EnumElement]/CurrNominal: .class({#struct: String#})[#MyEnum#]; name=class(struct: String) |
| 40 | +// STATIC_SELF_NODOT-DAG: Decl[EnumElement]/CurrNominal: .let({#`var`: String#})[#MyEnum#]; name=let(`var`: String) |
| 41 | +// STATIC_SELF_NODOT-DAG: Decl[Constructor]/CurrNominal: .init({#init: String#})[#MyEnum#]; name=init(init: String) |
| 42 | +// STATIC_SELF_NODOT-DAG: Decl[StaticMethod]/CurrNominal: .public({#private: String#})[#Int#]; name=public(private: String) |
| 43 | +// STATIC_SELF_NODOT-DAG: Decl[InstanceMethod]/CurrNominal: .`init`({#(self): MyEnum#})[#(deinit: String) -> Int#]; name=`init`(self: MyEnum) |
| 44 | +// STATIC_SELF_NODOT-DAG: Decl[InstanceMethod]/CurrNominal: .if({#(self): MyEnum#})[#(else: String) -> Int#]; name=if(self: MyEnum) |
| 45 | +// STATIC_SELF_NODOT: End completion |
| 46 | + |
| 47 | + let _ = self.#^STATIC_SELF_DOT^# |
| 48 | +// STATIC_SELF_DOT: Begin completions |
| 49 | +// STATIC_SELF_DOT-DAG: Keyword[self]/CurrNominal: self[#MyEnum.Type#]; name=self |
| 50 | +// STATIC_SELF_DOT-DAG: Decl[EnumElement]/CurrNominal: class({#struct: String#})[#MyEnum#]; name=class(struct: String) |
| 51 | +// STATIC_SELF_DOT-DAG: Decl[EnumElement]/CurrNominal: let({#`var`: String#})[#MyEnum#]; name=let(`var`: String) |
| 52 | +// STATIC_SELF_DOT-DAG: Decl[Constructor]/CurrNominal: init({#init: String#})[#MyEnum#]; name=init(init: String) |
| 53 | +// STATIC_SELF_DOT-DAG: Decl[StaticMethod]/CurrNominal: public({#private: String#})[#Int#]; name=public(private: String) |
| 54 | +// STATIC_SELF_DOT-DAG: Decl[InstanceMethod]/CurrNominal: `init`({#(self): MyEnum#})[#(deinit: String) -> Int#]; name=`init`(self: MyEnum) |
| 55 | +// STATIC_SELF_DOT-DAG: Decl[InstanceMethod]/CurrNominal: if({#(self): MyEnum#})[#(else: String) -> Int#]; name=if(self: MyEnum) |
| 56 | +// STATIC_SELF_DOT: End completion |
| 57 | + |
| 58 | + let _ = meta#^META_NODOT^# |
| 59 | +// SAME AS 'STATIC_SELF_NODOT'. |
| 60 | + |
| 61 | + let _ = meta.#^META_DOT^# |
| 62 | +// SAME AS 'STATIC_SELF_DOT'. |
| 63 | + } |
| 64 | + |
| 65 | + func testInstance(val: MyEnum) { |
| 66 | + let _ = #^INSTANCE_PRIMARY^# |
| 67 | +// INSTANCE_PRIMARY: Begin completion |
| 68 | +// INSTANCE_PRIMARY-DAG: Decl[LocalVar]/Local: self[#MyEnum#]; name=self |
| 69 | +// INSTANCE_PRIMARY-DAG: Decl[InstanceVar]/CurrNominal: self[#Int#]; name=self |
| 70 | +// FIXME: ^ This is shadowed. We should hide this. |
| 71 | +// INSTANCE_PRIMARY-DAG: Decl[InstanceMethod]/CurrNominal: `init`({#deinit: String#})[#Int#]; name=`init`(deinit: String) |
| 72 | +// INSTANCE_PRIMARY-DAG: Decl[InstanceMethod]/CurrNominal: `if`({#else: String#})[#Int#]; name=`if`(else: String) |
| 73 | +// INSTANCE_PRIMARY: End completion |
| 74 | + |
| 75 | + let _ = self#^INSTANCE_SELF_NODOT^# |
| 76 | +// INSTANCE_SELF_NODOT: Begin completions |
| 77 | +// INSTANCE_SELF_NODOT-DAG: Decl[InstanceMethod]/CurrNominal: .`init`({#deinit: String#})[#Int#]; name=`init`(deinit: String) |
| 78 | +// INSTANCE_SELF_NODOT-DAG: Decl[InstanceMethod]/CurrNominal: .if({#else: String#})[#Int#]; name=if(else: String) |
| 79 | +// INSTANCE_SELF_NODOT-DAG: Decl[InstanceVar]/CurrNominal: .`self`[#Int#]; name=`self` |
| 80 | +// INSTANCE_SELF_NODOT-DAG: Keyword[self]/CurrNominal: .self[#MyEnum#]; name=self |
| 81 | + |
| 82 | +// INSTANCE_SELF_NODOT: End completions |
| 83 | + |
| 84 | + let _ = self.#^INSTANCE_SELF_DOT^# |
| 85 | +// INSTANCE_SELF_DOT: Begin completions |
| 86 | +// INSTANCE_SELF_DOT-DAG: Decl[InstanceMethod]/CurrNominal: `init`({#deinit: String#})[#Int#]; name=`init`(deinit: String) |
| 87 | +// INSTANCE_SELF_DOT-DAG: Decl[InstanceMethod]/CurrNominal: if({#else: String#})[#Int#]; name=if(else: String) |
| 88 | +// INSTANCE_SELF_DOT-DAG: Decl[InstanceVar]/CurrNominal: `self`[#Int#]; name=`self` |
| 89 | +// INSTANCE_SELF_DOT-DAG: Keyword[self]/CurrNominal: self[#MyEnum#]; name=self |
| 90 | +// INSTANCE_SELF_DOT: End completions |
| 91 | + |
| 92 | + let _ = val#^VALUE_NODOT^# |
| 93 | +// SAME AS 'INSTANCE_SELF_NODOT'. |
| 94 | + let _ = val.#^VALUE_DOT^# |
| 95 | +// SAME AS 'INSTANCE_SELF_DOT'. |
| 96 | + } |
| 97 | +} |
0 commit comments