1- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_1 | %FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_1
2- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_1P | %FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_1P
3- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_2 | %FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_2
4- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_2P | %FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_2P
5-
6- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_1 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_1
7- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_1P | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_1P
8-
9- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_2 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_2
10- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_2P | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_2P
11-
12- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_3P | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_3P
13-
14- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_SELECTOR_1 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_SELECTOR_1
15-
16- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_VAL_META_1 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_VAL_META_1
17-
18- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_VAL_META_2 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_VAL_META_2
19-
20- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_BASE_DERIVED_1 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_BASE_DERIVED_1
21-
22- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_INIT_FROM_PROT_NODOT | %FileCheck %s -check-prefix=DEFAULT_INIT_FROM_PROT
23-
24- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_INIT_FROM_PROT_DOT | %FileCheck %s -check-prefix=DEFAULT_INIT_FROM_PROT
25-
26- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_INIT_FROM_PROT_PAREN | %FileCheck %s -check-prefix=DEFAULT_INIT_FROM_PROT
27-
28- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE1 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE1
29- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE2_1 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE2_NOINIT
30- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE2_2 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE2_NOINIT
31- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE2_3 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE2_NOINIT
32- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE2_4 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE2_SHOW_INIT
33- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE2_5 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE2_SHOW_INIT
34- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE2_6 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE2_NOINIT
35- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE3 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE3
36- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE4 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE4
37- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE5 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE4
38- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE6 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE6
39-
40- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAVE_RPAREN_1 | %FileCheck %s -check-prefix=HAVE_RPAREN_1
41- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAVE_RPAREN_2 | %FileCheck %s -check-prefix=HAVE_RPAREN_2
42- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAVE_COMMA_1 -code-complete-call-pattern-heuristics | %FileCheck %s -check-prefix=HAVE_COMMA_1
43- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAVE_COMMA_1 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_1P
44- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_ALIAS_1 | %FileCheck %s -check-prefix=WITH_ALIAS_1
45- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_1 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
46- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_2 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
47- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_3 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
48- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_4 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
49-
50- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABLE_1 | %FileCheck %s -check-prefix=AVAILABLE_1
51- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABLE_2 | %FileCheck %s -check-prefix=AVAILABLE_1
52-
53- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPENDENT_IN_CLOSURE_1 | %FileCheck %s -check-prefix=DEPENDENT_IN_CLOSURE_1
54- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPENDENT_IN_CLOSURE_2 | %FileCheck %s -check-prefix=DEPENDENT_IN_CLOSURE_2
55- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_WITH_UNRESOLVEDTYPE_1 | %FileCheck %s -check-prefix=INIT_WITH_UNRESOLVEDTYPE_1
1+ // RUN: %empty-directory(%t)
2+ // RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t
563
574func freeFunc( ) { }
585
@@ -196,9 +143,9 @@ func testExplicitConstructorsSelector2() {
196143 ExplicitConstructorsSelector2#^EXPLICIT_CONSTRUCTORS_SELECTOR_2^#
197144// EXPLICIT_CONSTRUCTORS_SELECTOR_2: Begin completions, 6 items
198145// EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#noArgs: ()#})[#ExplicitConstructorsSelector2#]{{; name=.+$}}
199- // EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#Int#})[#ExplicitConstructorsSelector2#]{{; name=.+$}}
200- // EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#Int#}, {#withFloat: Float#})[#ExplicitConstructorsSelector2#]{{; name=.+$}}
201- // EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#int: Int#}, {#Float#})[#ExplicitConstructorsSelector2#]{{; name=.+$}}
146+ // EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#(a): Int#})[#ExplicitConstructorsSelector2#]{{; name=.+$}}
147+ // EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#(a): Int#}, {#withFloat: Float#})[#ExplicitConstructorsSelector2#]{{; name=.+$}}
148+ // EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#int: Int#}, {#(b): Float#})[#ExplicitConstructorsSelector2#]{{; name=.+$}}
202149// EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Keyword[self]/CurrNominal: .self[#ExplicitConstructorsSelector2.Type#]; name=self
203150// EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Keyword/CurrNominal: .Type[#ExplicitConstructorsSelector2.Type#]; name=Type
204151// EXPLICIT_CONSTRUCTORS_SELECTOR_2: End completions
@@ -218,7 +165,7 @@ class ExplicitConstructorsDerived2 : ExplicitConstructorsBase1 {
218165 init ( ) { }
219166 required init ( a : Int ) { }
220167 class func foo( ) {
221- self . #^INIT_FROM_METATYPE5^#
168+ self . #^INIT_FROM_METATYPE5? check = INIT_FROM_METATYPE4 ^#
222169 }
223170}
224171
@@ -246,12 +193,12 @@ func testGetInitFromMetatype1() {
246193func testGetInitFromMetatype2( ) {
247194 var S1 = ExplicitConstructorsBase1 . self
248195 var S2 = ExplicitConstructorsDerived2 . self
249- S1. #^INIT_FROM_METATYPE2_1^#
250- S1#^INIT_FROM_METATYPE2_2^#
251- S1( #^INIT_FROM_METATYPE2_3 ^#
252- S2 . #^INIT_FROM_METATYPE2_4^#
253- S2 #^INIT_FROM_METATYPE2_5 ^#
254- S2 ( #^INIT_FROM_METATYPE2_6 ^#
196+ S1. #^INIT_FROM_METATYPE2_1? check = INIT_FROM_METATYPE2_NOINIT ^#
197+ S1#^INIT_FROM_METATYPE2_2? check = INIT_FROM_METATYPE2_NOINIT ^#
198+ S1( #^INIT_FROM_METATYPE2_3 ? check = INIT_FROM_METATYPE2_NOINIT ^#
199+ S2 . #^INIT_FROM_METATYPE2_4? check = INIT_FROM_METATYPE2_SHOW_INIT ^#
200+ S2 #^INIT_FROM_METATYPE2_5 ? check = INIT_FROM_METATYPE2_SHOW_INIT ^#
201+ S2 ( #^INIT_FROM_METATYPE2_6 ? check = INIT_FROM_METATYPE2_NOINIT ^#
255202}
256203// INIT_FROM_METATYPE2_NOINIT-NOT: Decl[Constructor]
257204
@@ -301,8 +248,7 @@ func testHaveRParen2() {
301248}
302249
303250func testHaveComma1( ) {
304- ExplicitConstructors1( #^HAVE_COMMA_1 ^#,
305- // HAVE_COMMA_1-NOT: Decl[Constructor]
251+ ExplicitConstructors1( #^HAVE_COMMA_1 ? check= EXPLICIT_CONSTRUCTORS_1P^#,
306252}
307253
308254//===--- Test that we show default constuctors inherited from protocols
@@ -315,9 +261,9 @@ class ConformsToProtDefaultInit: ProtDefaultInit {
315261}
316262
317263func testHasDefaultInitFromProtocol( ) {
318- ConformsToProtDefaultInit#^DEFAULT_INIT_FROM_PROT_NODOT^#
319- ConformsToProtDefaultInit. #^DEFAULT_INIT_FROM_PROT_DOT^#
320- ConformsToProtDefaultInit( #^DEFAULT_INIT_FROM_PROT_PAREN^#
264+ ConformsToProtDefaultInit#^DEFAULT_INIT_FROM_PROT_NODOT? check = DEFAULT_INIT_FROM_PROT ^#
265+ ConformsToProtDefaultInit. #^DEFAULT_INIT_FROM_PROT_DOT? check = DEFAULT_INIT_FROM_PROT ^#
266+ ConformsToProtDefaultInit( #^DEFAULT_INIT_FROM_PROT_PAREN? check = DEFAULT_INIT_FROM_PROT ^#
321267
322268// DEFAULT_INIT_FROM_PROT-DAG: Decl[Constructor]/CurrNominal: {{.+}}{#bar: Int#}
323269// DEFAULT_INIT_FROM_PROT-DAG: Decl[Constructor]/Super: {{.+}}{#foo: Int#}
@@ -340,13 +286,13 @@ struct ClosureInInit1 {
340286 }
341287// CLOSURE_IN_INIT_1: Decl[Constructor]/CurrNominal{{(/TypeRelation\[Identical\])?}}: ['(']{#Int#}[')'][#S#];
342288 var prop2: S = {
343- return S( #^CLOSURE_IN_INIT_2 ^#
289+ return S ( #^CLOSURE_IN_INIT_2 ? check = CLOSURE_IN_INIT_1 ^#
344290 } ( )
345291 var prop3 : S = {
346- S( #^CLOSURE_IN_INIT_3 ^#
292+ S( #^CLOSURE_IN_INIT_3 ? check = CLOSURE_IN_INIT_1 ^#
347293 }
348294 var prop3 : S = {
349- S( #^CLOSURE_IN_INIT_4 ^#
295+ S ( #^CLOSURE_IN_INIT_4 ? check = CLOSURE_IN_INIT_1 ^#
350296 } ( )
351297}
352298
@@ -371,7 +317,7 @@ func testAvailable() {
371317// AVAILABLE_1-DAG: Decl[Constructor]/CurrNominal: ['(']{#normal2: Int#}[')'][#AvailableTest#]; name=normal2: Int
372318// AVAILABLE_1: End completions
373319
374- let _ = AvailableTest . init( #^AVAILABLE_2 ^#
320+ let _ = AvailableTest . init( #^AVAILABLE_2 ? check = AVAILABLE_1 ^#
375321}
376322
377323protocol DataType {
@@ -383,6 +329,11 @@ class DependentTypeInClosure<Data: DataType> {
383329}
384330func testDependentTypeInClosure( ) {
385331 let _: DependentTypeInClosure = . #^DEPENDENT_IN_CLOSURE_3 ^#
332+ // DEPENDENT_IN_CLOSURE_3: Begin completions, 2 items
333+ // DEPENDENT_IN_CLOSURE_3-DAG: Decl[Constructor]/CurrNominal/TypeRelation[Identical]: init({#(arg): DataType#}, {#fn: (Data.Content) -> Void##(Data.Content) -> Void#})[#DependentTypeInClosure<DataType>#];
334+ // DEPENDENT_IN_CLOSURE_3-DAG: Decl[Constructor]/CurrNominal/TypeRelation[Identical]: init({#arg: DataType#}, {#fn: () -> Data.Content##() -> Data.Content#})[#DependentTypeInClosure<DataType>#];
335+ // DEPENDENT_IN_CLOSURE_3: End completions
336+
386337 let _ = DependentTypeInClosure ( #^DEPENDENT_IN_CLOSURE_1 ^#)
387338// DEPENDENT_IN_CLOSURE_1: Begin completions
388339// DEPENDENT_IN_CLOSURE_1-DAG: Decl[Constructor]/CurrNominal: ['(']{#(arg): _#}, {#fn: (_.Content) -> Void##(_.Content) -> Void#}[')'][#DependentTypeInClosure<_>#];
0 commit comments