From 1d28287f4b10c52fb37d1509a93c95669c003bc4 Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Thu, 1 Apr 2021 20:59:04 -0700 Subject: [PATCH] [CodeCompletion] Migrate some tests to batch completion test --- test/IDE/complete_after_self.swift | 87 +--- test/IDE/complete_ambiguous.swift | 131 ++---- test/IDE/complete_operators.swift | 119 ++---- test/IDE/complete_unresolved_members.swift | 321 +++++---------- test/IDE/complete_value_expr.swift | 373 ++++-------------- ...e_value_expr_call_pattern_heuristics.swift | 25 ++ 6 files changed, 291 insertions(+), 765 deletions(-) create mode 100644 test/IDE/complete_value_expr_call_pattern_heuristics.swift diff --git a/test/IDE/complete_after_self.swift b/test/IDE/complete_after_self.swift index 0f616400ab595..de77f70a22efa 100644 --- a/test/IDE/complete_after_self.swift +++ b/test/IDE/complete_after_self.swift @@ -1,64 +1,5 @@ -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SELF_NO_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SELF_NO_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_NONSELF_NO_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SELF_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SELF_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONVENIENCE_SELF_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=CONVENIENCE_SELF_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_NONSELF_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DESTRUCTOR_SELF_NO_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=DESTRUCTOR_SELF_NO_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DESTRUCTOR_SELF_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=DESTRUCTOR_SELF_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_SELF_NO_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=FUNC_SELF_NO_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STATIC_SELF_PAREN > %t.self.txt -// RUN: %FileCheck %s -check-prefix=STATIC_SELF_PAREN < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_SELF_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=FUNC_SELF_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_STATIC_SELF_NO_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=FUNC_STATIC_SELF_NO_DOT_1 < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_STATIC_SELF_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=FUNC_STATIC_SELF_DOT_1 < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_CONSTRUCTOR_SELF_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=STRUCT_CONSTRUCTOR_SELF_DOT_1 < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_CONSTRUCTOR_NONSELF_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXTENSION_CONSTRUCTOR_SELF_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt -// RUN: %FileCheck %s -check-prefix=EXTENSION_CONSTRUCTOR_SELF_DOT_1 < %t.self.txt - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_FUNC_SELF_DOT_1 > %t.self.txt -// RUN: %FileCheck %s -check-prefix=NO_INIT < %t.self.txt +// RUN: %empty-directory(%t) +// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t //===--- //===--- Tests for code completion after 'self'. @@ -176,26 +117,26 @@ class ThisDerived1 : ThisBase1 { // COMMON_SELF_DOT_1: End completions init() { - self#^CONSTRUCTOR_SELF_NO_DOT_1^# + self#^CONSTRUCTOR_SELF_NO_DOT_1?check=CONSTRUCTOR_SELF_NO_DOT_1;check=COMMON_SELF_NO_DOT_1^# // CONSTRUCTOR_SELF_NO_DOT_1: Begin completions, 21 items // CONSTRUCTOR_SELF_NO_DOT_1-NOT: Decl[Constructor] // CONSTRUCTOR_SELF_NO_DOT_1: End completions let d: ThisDerived1 - d#^CONSTRUCTOR_NONSELF_NO_DOT_1^# + d#^CONSTRUCTOR_NONSELF_NO_DOT_1?check=COMMON_SELF_NO_DOT_1;check=NO_INIT^# // NO_INIT-NOT: init() } init(a: Int) { - self.#^CONSTRUCTOR_SELF_DOT_1^# + self.#^CONSTRUCTOR_SELF_DOT_1?check=CONSTRUCTOR_SELF_DOT_1;check=COMMON_SELF_DOT_1^# // CONSTRUCTOR_SELF_DOT_1: Begin completions, 16 items // CONSTRUCTOR_SELF_DOT_1-NOT: Decl[Constructor] // CONSTRUCTOR_SELF_DOT_1: End completions let d: ThisDerived1 - d.#^CONSTRUCTOR_NONSELF_DOT_1^# + d.#^CONSTRUCTOR_NONSELF_DOT_1?check=COMMON_SELF_DOT_1;check=NO_INIT^# } convenience init(conv: Int) { - self.#^CONVENIENCE_SELF_DOT_1^# + self.#^CONVENIENCE_SELF_DOT_1?check=CONVENIENCE_SELF_DOT_1;check=COMMON_SELF_DOT_1^# // CONVENIENCE_SELF_DOT_1: Begin completions, 20 items // CONVENIENCE_SELF_DOT_1-DAG: Decl[Constructor]/CurrNominal: init()[#ThisDerived1#]; name=init() // CONVENIENCE_SELF_DOT_1-DAG: Decl[Constructor]/CurrNominal: init({#a: Int#})[#ThisDerived1#]; name=init(a: Int) @@ -204,23 +145,23 @@ class ThisDerived1 : ThisBase1 { } deinit { - self#^DESTRUCTOR_SELF_NO_DOT_1^# + self#^DESTRUCTOR_SELF_NO_DOT_1?check=DESTRUCTOR_SELF_NO_DOT_1;check=COMMON_SELF_NO_DOT_1;check=NO_INIT^# // DESTRUCTOR_SELF_NO_DOT_1: Begin completions, 21 items // DESTRUCTOR_SELF_NO_DOT_1: End completions - self.#^DESTRUCTOR_SELF_DOT_1^# + self.#^DESTRUCTOR_SELF_DOT_1?check=DESTRUCTOR_SELF_DOT_1;check=COMMON_SELF_DOT_1;check=NO_INIT^# // DESTRUCTOR_SELF_DOT_1: Begin completions, 16 items // DESTRUCTOR_SELF_DOT_1: End completions } func test1() { - self#^FUNC_SELF_NO_DOT_1^# + self#^FUNC_SELF_NO_DOT_1?check=FUNC_SELF_NO_DOT_1;check=COMMON_SELF_NO_DOT_1;check=NO_INIT^# // FUNC_SELF_NO_DOT_1: Begin completions, 21 items // FUNC_SELF_NO_DOT_1: End completions } func test2() { - self.#^FUNC_SELF_DOT_1^# + self.#^FUNC_SELF_DOT_1?check=FUNC_SELF_DOT_1;check=COMMON_SELF_DOT_1;check=NO_INIT^# // FUNC_SELF_DOT_1: Begin completions, 16 items // FUNC_SELF_DOT_1: End completions } @@ -329,7 +270,7 @@ extension ThisDerived1 { typealias DerivedExtNestedTypealias = Int convenience init(someExtensionArg: Int) { - self.#^EXTENSION_CONSTRUCTOR_SELF_DOT_1^# + self.#^EXTENSION_CONSTRUCTOR_SELF_DOT_1?check=COMMON_SELF_DOT_1;check=EXTENSION_CONSTRUCTOR_SELF_DOT_1^# // EXTENSION_CONSTRUCTOR_SELF_DOT_1: Begin completions, 20 items // EXTENSION_CONSTRUCTOR_SELF_DOT_1: Decl[Constructor]/CurrNominal: init()[#ThisDerived1#]; name=init() // EXTENSION_CONSTRUCTOR_SELF_DOT_1: Decl[Constructor]/CurrNominal: init({#a: Int#})[#ThisDerived1#]; name=init(a: Int) @@ -350,9 +291,9 @@ struct S1 { // STRUCT_CONSTRUCTOR_SELF_DOT_1-DAG: Decl[InstanceMethod]/CurrNominal: f()[#Void#]; name=f() // STRUCT_CONSTRUCTOR_SELF_DOT_1: End completions let s: S1 - s.#^STRUCT_CONSTRUCTOR_NONSELF_DOT_1^# + s.#^STRUCT_CONSTRUCTOR_NONSELF_DOT_1?check=NO_INIT^# } func f() { - self.#^STRUCT_FUNC_SELF_DOT_1^# + self.#^STRUCT_FUNC_SELF_DOT_1?check=NO_INIT^# } } diff --git a/test/IDE/complete_ambiguous.swift b/test/IDE/complete_ambiguous.swift index a8b4110a33e96..e4ba8f0f71573 100644 --- a/test/IDE/complete_ambiguous.swift +++ b/test/IDE/complete_ambiguous.swift @@ -1,57 +1,5 @@ -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=SIMPLE | %FileCheck %s --check-prefix=SIMPLE -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=SIMPLE_EXTRAARG | %FileCheck %s --check-prefix=SIMPLE -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=SIMPLE_MEMBERS | %FileCheck %s --check-prefix=SIMPLE -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=SKIP_DUPLICATES > %t -// RUN: %FileCheck %s --input-file %t --check-prefixes=SKIP_DUPLICATES,SKIP_DUPLICATES_PROPERTY -// RUN: %FileCheck %s --input-file %t --check-prefixes=SKIP_DUPLICATES,SKIP_DUPLICATES_METHOD -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=SKIP_COMPOUND_DUPLICATES | %FileCheck %s --check-prefix=SKIP_COMPOUND_DUPLICATES -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=SKIP_CALLASFUNCTION_DUPLICATES | %FileCheck %s --check-prefix=SKIP_CALLASFUNCTION_DUPLICATES -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=RELATED | %FileCheck %s --check-prefix=RELATED -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=RELATED_EXTRAARG | %FileCheck %s --check-prefix=RELATED -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=RELATED_INERROREXPR | %FileCheck %s --check-prefix=RELATED -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_AMBIGUOUS | %FileCheck %s --check-prefix=UNRESOLVED_AMBIGUOUS -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_STILLAMBIGUOUS | %FileCheck %s --check-prefix=UNRESOLVED_AMBIGUOUS -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_UNAMBIGUOUS | %FileCheck %s --check-prefix=UNRESOLVED_UNAMBIGUOUS -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=NOCALLBACK_FALLBACK | %FileCheck %s --check-prefix=RELATED -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTICLOSURE_FALLBACK | %FileCheck %s --check-prefix=MULTICLOSURE_FALLBACK -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=UNAMBIGUOUSCLOSURE_ARG | %FileCheck %s --check-prefix=UNAMBIGUOUSCLOSURE_ARG -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=AMBIGUOUSCLOSURE_ARG | %FileCheck %s --check-prefix=AMBIGUOUSCLOSURE_ARG -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=AMBIGUOUSCLOSURE_ARG_RETURN | %FileCheck %s --check-prefix=AMBIGUOUSCLOSURE_ARG_RETURN -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_KEY -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_OPTIONAL | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_KEY -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_NESTED | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_KEY -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_ASSIGN | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_KEY -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_INDIRECT | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_KEY -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_INDIRECT_NESTED | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_KEY -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_INDIRECT_CALL | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_KEY -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_INDIRECT_CALL_OPT | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_KEY -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_INDIRECT_RETURN | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_KEY -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_GENERIC | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_KEY -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_TUPLE | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_TUPLE -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=PARSED_AS_ARRAY_ARRAY | %FileCheck %s --check-prefix=PARSED_AS_ARRAY_TUPLE -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADEDFUNC_FOO | %FileCheck %s --check-prefix=OVERLOADEDFUNC_FOO -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADEDFUNC_BAR | %FileCheck %s --check-prefix=OVERLOADEDFUNC_BAR -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADEDFUNC_MISSINGLABEL | %FileCheck %s --check-prefix=OVERLOADEDFUNC_BOTH -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADEDFUNC_MISSINGARG_AFTER | %FileCheck %s --check-prefix=OVERLOADEDFUNC_BOTH -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADEDMEMBER_MISSINGARG_AFTER | %FileCheck %s --check-prefix=OVERLOADEDFUNC_BOTH -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADEDFUNC_MISSINGARG_BEFORE | %FileCheck %s --check-prefix=OVERLOADEDFUNC_BAR -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADEDFUNC_MISSINGARG_BEFOREANDAFTER | %FileCheck %s --check-prefix=OVERLOADEDFUNC_BAR -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=ERROR_IN_BASE | %FileCheck %s --check-prefix=SIMPLE -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC | %FileCheck %s --check-prefix=GENERIC -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_MISSINGARG | %FileCheck %s --check-prefix=NORESULTS -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_MISSINGARG | %FileCheck %s --check-prefix=POINT_MEMBER -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_NORETURN | %FileCheck %s --check-prefix=POINT_MEMBER -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_FUNCBUILDER | %FileCheck %s --check-prefix=POINT_MEMBER -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTICLOSURE_FUNCBUILDER | %FileCheck %s --check-prefix=POINT_MEMBER -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTICLOSURE_FUNCBUILDER_ERROR | %FileCheck %s --check-prefix=POINT_MEMBER -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTICLOSURE_FUNCBUILDER_FIXME | %FileCheck %s --check-prefix=NORESULTS -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=REGULAR_MULTICLOSURE_APPLIED | %FileCheck %s --check-prefix=POINT_MEMBER -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=BEST_SOLUTION_FILTER | %FileCheck %s --check-prefix=BEST_SOLUTION_FILTER -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=BEST_SOLUTION_FILTER2 | %FileCheck %s --check-prefix=BEST_SOLUTION_FILTER -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=BEST_SOLUTION_FILTER_GEN | %FileCheck %s --check-prefix=BEST_SOLUTION_FILTER_GEN -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=MISSINGARG_INLINE | %FileCheck %s --check-prefix=MISSINGARG_INLINE -// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=MISSINGARG_TRAILING | %FileCheck %s --check-prefix=MISSINGARG_TRAILING - +// RUN: %empty-directory(%t) +// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t struct A { func doAThings() -> A { return self } @@ -65,14 +13,14 @@ func overloadedReturn() -> A { return A() } func overloadedReturn() -> B { return B() } overloadedReturn().#^SIMPLE^# -overloadedReturn(1).#^SIMPLE_EXTRAARG^# +overloadedReturn(1).#^SIMPLE_EXTRAARG?check=SIMPLE^# struct HasMembers { func overloadedReturn() -> A { return A() } func overloadedReturn() -> B { return B() } } -HasMembers().overloadedReturn().#^SIMPLE_MEMBERS^# +HasMembers().overloadedReturn().#^SIMPLE_MEMBERS?check=SIMPLE^# func givenErrorExpr(_ a: String) -> A {} func givenErrorExpr(_ b: Int) -> B {} @@ -81,10 +29,12 @@ func arrayWrapper(a: T) -> [T] arrayWrapper(overloadedReturn()).#^SKIP_DUPLICATES^# // SKIP_DUPLICATES: Begin completions -// SKIP_DUPLICATES_PROPERTY: Decl[InstanceVar]/CurrNominal/IsSystem: count[#Int#]{{; name=.+$}} -// SKIP_DUPLICATES_PROPERTY-NOT: count[#Int#] -// SKIP_DUPLICATES_METHOD: Decl[InstanceMethod]/Super/IsSystem: formIndex({#(i): &Int#}, {#offsetBy: Int#})[#Void#]{{; name=.+$}} -// SKIP_DUPLICATES_METHOD-NOT: formIndex({#(i): &Int#}, {#offsetBy: Int#})[#Void#] +// SKIP_DUPLICATES-NOT: count[#Int#] +// SKIP_DUPLICATES-NOT: formIndex({#(i): &Int#}, {#offsetBy: Int#})[#Void#] +// SKIP_DUPLICATES: Decl[InstanceVar]/CurrNominal/IsSystem: count[#Int#]{{; name=.+$}} +// SKIP_DUPLICATES: Decl[InstanceMethod]/Super/IsSystem: formIndex({#(i): &Int#}, {#offsetBy: Int#})[#Void#]{{; name=.+$}} +// SKIP_DUPLICATES-NOT: count[#Int#] +// SKIP_DUPLICATES-NOT: formIndex({#(i): &Int#}, {#offsetBy: Int#})[#Void#] // SKIP_DUPLICATES: End completions let x: (inout Int, Int) -> () = arrayWrapper(overloadedReturn()).#^SKIP_COMPOUND_DUPLICATES^# @@ -108,7 +58,7 @@ func testCallAsFunctionDeduplication() { // FIXME: Update this to check the callAsFunction pattern only appears once when PostfixExpr completion is migrated to the solver-based implementation (which handles ambiguity). // SKIP_CALLASFUNCTION_DUPLICATES-NOT: Begin completions -givenErrorExpr(undefined).#^ERROR_IN_BASE^# +givenErrorExpr(undefined).#^ERROR_IN_BASE?check=SIMPLE^# // SIMPLE: Begin completions, 4 items // SIMPLE-DAG: Keyword[self]/CurrNominal: self[#A#]{{; name=.+$}} @@ -118,7 +68,7 @@ givenErrorExpr(undefined).#^ERROR_IN_BASE^# // SIMPLE: End completions let x: A = overloadedReturn().#^RELATED^# -let x: A = overloadedReturn(1).#^RELATED_EXTRAARG^# +let x: A = overloadedReturn(1).#^RELATED_EXTRAARG?check=RELATED^# // RELATED: Begin completions, 4 items // RELATED-DAG: Keyword[self]/CurrNominal: self[#A#]{{; name=.+$}} @@ -130,7 +80,7 @@ let x: A = overloadedReturn(1).#^RELATED_EXTRAARG^# func takesClosureGivingA(_ callback: () -> A) -> B {} func takesB(_ item: B) {} -takesB((takesClosureGivingA { return overloadedReturn().#^RELATED_INERROREXPR^# }).) +takesB((takesClosureGivingA { return overloadedReturn().#^RELATED_INERROREXPR?check=RELATED^# }).) func overloadedArg(_ arg: A) -> A {} func overloadedArg(_ arg: B) -> B {} @@ -145,7 +95,7 @@ overloadedArg(.#^UNRESOLVED_AMBIGUOUS^#) // UNRESOLVED_AMBIGUOUS: End completions // Make sure we still offer A and B members as the user may intend to add a member on the end of the overloadedArg call later that has type B. -takesB(overloadedArg(.#^UNRESOLVED_STILLAMBIGUOUS^#)) +takesB(overloadedArg(.#^UNRESOLVED_STILLAMBIGUOUS?check=UNRESOLVED_AMBIGUOUS^#)) func overloadedArg2(_ arg: A) -> Void {} func overloadedArg2(_ arg: A) -> Never {} @@ -160,7 +110,7 @@ takesB(overloadedArg2(.#^UNRESOLVED_UNAMBIGUOUS^#)) switch undefined { - case takesClosureGivingA { return overloadedReturn().#^NOCALLBACK_FALLBACK^# }: + case takesClosureGivingA { return overloadedReturn().#^NOCALLBACK_FALLBACK?check=RELATED^# }: break } @@ -220,17 +170,17 @@ func overloadedGivesAorB(_ x: A) -> A {} func overloadedGivesAorB(_ x: B) -> B {} var assignDict: [A : B] = [:] -let _: [A : B] = [TestRelations.#^PARSED_AS_ARRAY^#] -let _: [A : B]? = [TestRelations.#^PARSED_AS_ARRAY_OPTIONAL^#] -let _: [[A : B]] = [[TestRelations.#^PARSED_AS_ARRAY_NESTED^#]] -assignDict = [TestRelations.#^PARSED_AS_ARRAY_ASSIGN^#] -let _: [A: B] = [overloadedGivesAorB(TestRelations.#^PARSED_AS_ARRAY_INDIRECT^#)] -let _: [[A: B]] = [[overloadedGivesAorB(TestRelations.#^PARSED_AS_ARRAY_INDIRECT_NESTED^#)]] -takesDictAB([overloadedGivesAorB(TestRelations.#^PARSED_AS_ARRAY_INDIRECT_CALL^#)]); -takesOptDictAB([overloadedGivesAorB(TestRelations.#^PARSED_AS_ARRAY_INDIRECT_CALL_OPT^#)]); -func testReturnLiteralMismatch() -> [A: B] { return [overloadedGivesAorB(TestRelations.#^PARSED_AS_ARRAY_INDIRECT_RETURN^#)] } +let _: [A : B] = [TestRelations.#^PARSED_AS_ARRAY?check=PARSED_AS_ARRAY_KEY^#] +let _: [A : B]? = [TestRelations.#^PARSED_AS_ARRAY_OPTIONAL?check=PARSED_AS_ARRAY_KEY^#] +let _: [[A : B]] = [[TestRelations.#^PARSED_AS_ARRAY_NESTED?check=PARSED_AS_ARRAY_KEY^#]] +assignDict = [TestRelations.#^PARSED_AS_ARRAY_ASSIGN?check=PARSED_AS_ARRAY_KEY^#] +let _: [A: B] = [overloadedGivesAorB(TestRelations.#^PARSED_AS_ARRAY_INDIRECT?check=PARSED_AS_ARRAY_KEY^#)] +let _: [[A: B]] = [[overloadedGivesAorB(TestRelations.#^PARSED_AS_ARRAY_INDIRECT_NESTED?check=PARSED_AS_ARRAY_KEY^#)]] +takesDictAB([overloadedGivesAorB(TestRelations.#^PARSED_AS_ARRAY_INDIRECT_CALL?check=PARSED_AS_ARRAY_KEY^#)]); +takesOptDictAB([overloadedGivesAorB(TestRelations.#^PARSED_AS_ARRAY_INDIRECT_CALL_OPT?check=PARSED_AS_ARRAY_KEY^#)]); +func testReturnLiteralMismatch() -> [A: B] { return [overloadedGivesAorB(TestRelations.#^PARSED_AS_ARRAY_INDIRECT_RETURN?check=PARSED_AS_ARRAY_KEY^#)] } func arrayLiteralDictionaryMismatch(a: inout T) where T: ExpressibleByDictionaryLiteral, T.Key == A, T.Value == B { - a = [TestRelations.#^PARSED_AS_ARRAY_GENERIC^#] + a = [TestRelations.#^PARSED_AS_ARRAY_GENERIC?check=PARSED_AS_ARRAY_KEY^#] } // PARSED_AS_ARRAY_KEY: Begin completions, 6 items @@ -243,7 +193,7 @@ func arrayLiteralDictionaryMismatch(a: inout T) where T: ExpressibleByDiction // PARSED_AS_ARRAY_KEY: End completions let _: [(A, B) : B] = [TestRelations.#^PARSED_AS_ARRAY_TUPLE^#] -let _: [(A, B)] = [TestRelations.#^PARSED_AS_ARRAY_ARRAY^#] +let _: [(A, B)] = [TestRelations.#^PARSED_AS_ARRAY_ARRAY?check=PARSED_AS_ARRAY_TUPLE^#] // PARSED_AS_ARRAY_TUPLE: Begin completions, 6 items // PARSED_AS_ARRAY_TUPLE-DAG: Keyword[self]/CurrNominal: self[#TestRelations.Type#]{{; name=.+$}} // PARSED_AS_ARRAY_TUPLE-DAG: Keyword/CurrNominal: Type[#TestRelations.Type#]{{; name=.+$}} @@ -294,8 +244,8 @@ func testMissingArgs() { // OVERLOADEDFUNC_BAR-DAG: Decl[Constructor]/CurrNominal: init()[#Test#]{{; name=.+$}} // OVERLOADEDFUNC_BAR: End completions - test(Test.#^OVERLOADEDFUNC_MISSINGLABEL^#, extraArg: 2) - test2(first: Test.#^OVERLOADEDFUNC_MISSINGARG_AFTER^#) + test(Test.#^OVERLOADEDFUNC_MISSINGLABEL?check=OVERLOADEDFUNC_BOTH^#, extraArg: 2) + test2(first: Test.#^OVERLOADEDFUNC_MISSINGARG_AFTER?check=OVERLOADEDFUNC_BOTH^#) // Also check ambiguous member functions struct TestStruct { @@ -303,7 +253,7 @@ func testMissingArgs() { func test2(first: Foo) {} } - TestStruct().test2(first: Test.#^OVERLOADEDMEMBER_MISSINGARG_AFTER^#) + TestStruct().test2(first: Test.#^OVERLOADEDMEMBER_MISSINGARG_AFTER?check=OVERLOADEDFUNC_BOTH^#) // TODO: Should we insert the missing label in the completion text for OVERLOADEDFUNC_MISSINGLABEL? // OVERLOADEDFUNC_BOTH: Begin completions, 5 items @@ -314,8 +264,8 @@ func testMissingArgs() { // OVERLOADEDFUNC_BOTH-DAG: Decl[Constructor]/CurrNominal: init()[#Test#]{{; name=.+$}} // OVERLOADEDFUNC_BOTH: End completions - test3(after: Test.#^OVERLOADEDFUNC_MISSINGARG_BEFORE^#); - test4(both: Test.#^OVERLOADEDFUNC_MISSINGARG_BEFOREANDAFTER^#) + test3(after: Test.#^OVERLOADEDFUNC_MISSINGARG_BEFORE?check=OVERLOADEDFUNC_BAR^#); + test4(both: Test.#^OVERLOADEDFUNC_MISSINGARG_BEFOREANDAFTER?check=OVERLOADEDFUNC_BAR^#) enum Bop { case bop } enum Bix { case bix } @@ -397,7 +347,7 @@ genericReturn(CDStruct()).#^GENERIC^# // GENERIC-DAG: Decl[InstanceMethod]/CurrNominal: doAThings()[#A#]{{; name=.+$}} // GENERIC: End completions -genericReturn().#^GENERIC_MISSINGARG^# +genericReturn().#^GENERIC_MISSINGARG?check=NORESULTS^# // NORESULTS-NOT: Begin completions @@ -422,13 +372,13 @@ struct Point { let _ = [Point(1, 4), Point(20, 2), Point(9, -4)] .filter { $0.magSquared > 4 } .min { - $0.#^CLOSURE_MISSINGARG^# + $0.#^CLOSURE_MISSINGARG?check=POINT_MEMBER^# } protocol SomeProto {} func testing(_ arg1: T, arg2: (T.Element) -> U) {} _ = testing([Point(4, 89)]) { arg in - arg.#^CLOSURE_NORETURN^# + arg.#^CLOSURE_NORETURN?check=POINT_MEMBER^# } struct Thing { @@ -443,7 +393,7 @@ func CreateThings(@ThingBuilder makeThings: () -> [Thing]) {} // In single statement closure CreateThings { Thing { point in - point.#^CLOSURE_FUNCBUILDER^# + point.#^CLOSURE_FUNCBUILDER?check=POINT_MEMBER^# } Thing { _ in } } @@ -452,7 +402,7 @@ CreateThings { CreateThings { Thing { point in print("hello") - point.#^MULTICLOSURE_FUNCBUILDER^# + point.#^MULTICLOSURE_FUNCBUILDER?check=POINT_MEMBER^# } Thing { _ in } } @@ -462,7 +412,7 @@ CreateThings { Thing { point in print("hello") point. // ErrorExpr - point.#^MULTICLOSURE_FUNCBUILDER_ERROR^# + point.#^MULTICLOSURE_FUNCBUILDER_ERROR?check=POINT_MEMBER^# } Thing { point in print("hello") @@ -474,7 +424,7 @@ CreateThings { CreateThings { Thing { point in print("hello") - point.#^MULTICLOSURE_FUNCBUILDER_FIXME^# + point.#^MULTICLOSURE_FUNCBUILDER_FIXME?check=NORESULTS^# } Thing. // ErrorExpr } @@ -486,7 +436,7 @@ func overloadedWithDefaulted(_: ()->(), _ defaulted: Int = 10) {} takesClosureOfPoint { p in overloadedWithDefaulted { - if p.#^REGULAR_MULTICLOSURE_APPLIED^# {} + if p.#^REGULAR_MULTICLOSURE_APPLIED?check=POINT_MEMBER^# {} } } @@ -499,7 +449,7 @@ struct Struct123: Equatable { func testBestSolutionFilter() { let a = Struct123(); let b = [Struct123]().first(where: { $0 == a && 1 + 90 * 5 / 8 == 45 * -10 })?.structMem != .#^BEST_SOLUTION_FILTER^# - let c = min(10.3, 10 / 10.4) < 6 / 7 ? true : Optional(a)?.structMem != .#^BEST_SOLUTION_FILTER2^# + let c = min(10.3, 10 / 10.4) < 6 / 7 ? true : Optional(a)?.structMem != .#^BEST_SOLUTION_FILTER2?check=BEST_SOLUTION_FILTER^# } // BEST_SOLUTION_FILTER: Begin completions @@ -522,3 +472,4 @@ func testBestSolutionGeneric() { // BEST_SOLUTION_FILTER_GEN-DAG: Keyword[self]/CurrNominal: self[#Int#]; name=self // BEST_SOLUTION_FILTER_GEN-DAG: Keyword[self]/CurrNominal: self[#Test1#]; name=self // BEST_SOLUTION_FILTER_GEN: End completions + diff --git a/test/IDE/complete_operators.swift b/test/IDE/complete_operators.swift index 51c250c0a6b1f..d77b275ab7f41 100644 --- a/test/IDE/complete_operators.swift +++ b/test/IDE/complete_operators.swift @@ -1,67 +1,5 @@ -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_1 | %FileCheck %s -check-prefix=POSTFIX_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_2 > %t -// RUN: %FileCheck %s -check-prefix=POSTFIX_2 < %t -// RUN: %FileCheck %s -check-prefix=NEGATIVE_POSTFIX_2 < %t - -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_3 | %FileCheck %s -check-prefix=POSTFIX_3 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_4 | %FileCheck %s -check-prefix=POSTFIX_4 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_5 | %FileCheck %s -check-prefix=POSTFIX_5 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_6 | %FileCheck %s -check-prefix=POSTFIX_6 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_7 | %FileCheck %s -check-prefix=POSTFIX_7 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_8 | %FileCheck %s -check-prefix=POSTFIX_8 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_9 | %FileCheck %s -check-prefix=POSTFIX_9 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_10 | %FileCheck %s -check-prefix=POSTFIX_10 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=S_POSTFIX_SPACE | %FileCheck %s -check-prefix=S_POSTFIX_SPACE - -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_1 > %t -// RUN: %FileCheck %s -check-prefix=S2_INFIX < %t -// RUN: %FileCheck %s -check-prefix=NEGATIVE_S2_INFIX < %t - -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_2 > %t -// RUN: %FileCheck %s -check-prefix=S2_INFIX_LVALUE < %t -// RUN: %FileCheck %s -check-prefix=NEGATIVE_S2_INFIX_LVALUE < %t - -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_3 | %FileCheck %s -check-prefix=S2_INFIX_LVALUE -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_4 | %FileCheck %s -check-prefix=S2_INFIX -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_5 | %FileCheck %s -check-prefix=S2_INFIX -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_6 | %FileCheck %s -check-prefix=S2_INFIX - -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_7 > %t -// RUN: %FileCheck %s -check-prefix=S2_INFIX_OPTIONAL < %t -// RUN: %FileCheck %s -check-prefix=NEGATIVE_S2_INFIX_OPTIONAL < %t - -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_8 | %FileCheck %s -check-prefix=S3_INFIX_OPTIONAL -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_9 | %FileCheck %s -check-prefix=FOOABLE_INFIX -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_10 | %FileCheck %s -check-prefix=FOOABLE_INFIX -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_11 | %FileCheck %s -check-prefix=INFIX_11 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_12 | %FileCheck %s -check-prefix=INFIX_12 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_13 | %FileCheck %s -check-prefix=NO_OPERATORS -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_14 | %FileCheck %s -check-prefix=NO_OPERATORS - -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_15 | %FileCheck %s -check-prefix=INFIX_15 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_16 | %FileCheck %s -check-prefix=INFIX_16 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_17 | %FileCheck %s -check-prefix=VOID_OPERATORS -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_18 | %FileCheck %s -check-prefix=NO_OPERATORS -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_19 | %FileCheck %s -check-prefix=EMPTYCLASS_INFIX -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_20 | %FileCheck %s -check-prefix=NO_OPERATORS -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_21 | %FileCheck %s -check-prefix=NO_OPERATORS -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_22 | %FileCheck %s -check-prefix=INFIX_22 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=S2_INFIX_SPACE | %FileCheck %s -check-prefix=S2_INFIX_SPACE -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_1 | %FileCheck %s -check-prefix=S2_INFIX -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_2 > %t.ext_infix_2 -// RUN: %FileCheck %s -check-prefix=S4_EXT_INFIX < %t.ext_infix_2 -// RUN: %FileCheck %s -check-prefix=S4_EXT_INFIX_NEG < %t.ext_infix_2 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_3 | %FileCheck %s -check-prefix=S4_EXT_INFIX_SIMPLE -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_4 | %FileCheck %s -check-prefix=S4_EXT_INFIX_SIMPLE -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ASSIGN_TUPLE_1| %FileCheck %s -check-prefix=ASSIGN_TUPLE_1 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ASSIGN_TUPLE_2| %FileCheck %s -check-prefix=ASSIGN_TUPLE_2 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ASSIGN_TUPLE_3| %FileCheck %s -check-prefix=ASSIGN_TUPLE_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_AUTOCLOSURE_1 | %FileCheck %s -check-prefix=INFIX_AUTOCLOSURE_1 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_AUTOCLOSURE_2 | %FileCheck %s -check-prefix=INFIX_AUTOCLOSURE_1 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_AUTOCLOSURE_3 | %FileCheck %s -check-prefix=INFIX_AUTOCLOSURE_1 -// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_AUTOCLOSURE_4 | %FileCheck %s -check-prefix=INFIX_AUTOCLOSURE_1 +// RUN: %empty-directory(%t) +// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t struct S {} postfix operator ++ {} @@ -73,7 +11,7 @@ func testPostfix1(x: S) { // POSTFIX_1-NOT: ++ func testPostfix2(x: inout S) { - x#^POSTFIX_2^# + x#^POSTFIX_2?check=POSTFIX_2;check=NEGATIVE_POSTFIX_2^# } // POSTFIX_2: Begin completions // POSTFIX_2-DAG: Decl[PostfixOperatorFunction]/CurrModule: ++[#S#] @@ -164,7 +102,7 @@ func **(x: S2, y: Int) -> S2 { return x } func **=(x: inout S2, y: Int) -> Void { return x } func testInfix1(x: S2) { - x#^INFIX_1^# + x#^INFIX_1?check=S2_INFIX;check=NEGATIVE_S2_INFIX^# } // S2_INFIX: Begin completions // FIXME: rdar://problem/22997089 - should be CurrModule @@ -180,7 +118,7 @@ func testInfix1(x: S2) { // NEGATIVE_S2_INFIX-NOT: = {# func testInfix2(x: inout S2) { - x#^INFIX_2^# + x#^INFIX_2?check=S2_INFIX_LVALUE;check=NEGATIVE_S2_INFIX_LVALUE^# } // S2_INFIX_LVALUE: Begin completions // FIXME: rdar://problem/22997089 - should be CurrModule @@ -196,23 +134,23 @@ func testInfix2(x: inout S2) { // NEGATIVE_S2_INFIX_LVALUE-NOT: ~> func testInfix3(x: inout S2) { - x#^INFIX_3^# + x#^INFIX_3?check=S2_INFIX_LVALUE^# } func testInfix4() { - S2()#^INFIX_4^# + S2()#^INFIX_4?check=S2_INFIX^# } func testInfix5() { - (S2() + S2())#^INFIX_5^# + (S2() + S2())#^INFIX_5?check=S2_INFIX^# } func testInfix6(x: T) { - x.foo()#^INFIX_6^# + x.foo()#^INFIX_6?check=S2_INFIX^# } func testInfix7(x: S2?) { - x#^INFIX_7^# + x#^INFIX_7?check=S2_INFIX_OPTIONAL;check=NEGATIVE_S2_INFIX_OPTIONAL^# } // S2_INFIX_OPTIONAL: Begin completions // S2_INFIX_OPTIONAL-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: != {#{{.*}}#}[#Bool#] @@ -227,7 +165,7 @@ func ==(x: S3, y: S3) -> Bool { return true } func !=(x: S3, y: S3) -> Bool { return false} func testInfix8(x: S3?) { - x#^INFIX_8^# + x#^INFIX_8?check=S3_INFIX_OPTIONAL^# } // The equality operators come from equatable. // S3_INFIX_OPTIONAL: Begin completions @@ -241,12 +179,12 @@ infix operator **** { func ****(x: T, y: T) -> T { return x } func testInfix9(x: T) { - x.foo()#^INFIX_9^# + x.foo()#^INFIX_9?check=FOOABLE_INFIX^# } // FOOABLE_INFIX: Decl[InfixOperatorFunction]/CurrModule: **** {#T.T#}[#T.T#] func testInfix10(x: T) { - (x.foo() **** x.foo())#^INFIX_10^# + (x.foo() **** x.foo())#^INFIX_10?check=FOOABLE_INFIX^# } func testInfix11() { @@ -270,12 +208,12 @@ func testInfix12() { // INFIX_12: End completions func testInfix13() { - P.foo#^INFIX_13^# + P.foo#^INFIX_13?check=NO_OPERATORS^# } // NO_OPERATORS-NOT: Decl[InfixOperatorFunction] func testInfix14() { - P.T#^INFIX_14^# + P.T#^INFIX_14?check=NO_OPERATORS^# } func testInfix15() { T#^INFIX_15^# @@ -297,7 +235,7 @@ func testInfix16() { // INFIX_16: End completions func testInfix17(x: Void) { - x#^INFIX_17^# + x#^INFIX_17?check=VOID_OPERATORS^# } // VOID_OPERATORS: Begin completions @@ -310,11 +248,11 @@ func testInfix17(x: Void) { // VOID_OPERATORS: End completions func testInfix18(x: (S2, S2) { - x#^INFIX_18^# + x#^INFIX_18?check=NO_OPERATORS^# } class EmptyClass {} func testInfix19(x: EmptyClass) { - x#^INFIX_19^# + x#^INFIX_19?check=EMPTYCLASS_INFIX^# } // EMPTYCLASS_INFIX: Begin completions @@ -327,10 +265,10 @@ enum E { case B(S2) } func testInfix20(x: E) { - x#^INFIX_20^# + x#^INFIX_20?check=NO_OPERATORS^# } func testInfix21() { - E.A#^INFIX_21^# + E.A#^INFIX_21?check=NO_OPERATORS^# } func testInfix22() { E.B#^INFIX_22^# @@ -348,7 +286,7 @@ func testSpace(x: S2) { // S2_INFIX_SPACE: End completions func testExtInfix1(x: inout S2) { - x + S2() + x + S2() + x + S2() + x#^EXT_INFIX_1^# + x + S2() + x + S2() + x + S2() + x#^EXT_INFIX_1?check=S2_INFIX^# } struct S4 {} @@ -369,7 +307,7 @@ precedencegroup ReallyHighPrecedence { func &&&(x: Bool, y: Bool) -> S4 { return x } func testExtInfix2(x: S4) { - x + x == x + x#^EXT_INFIX_2^# + x + x == x + x#^EXT_INFIX_2?check=S4_EXT_INFIX;check=S4_EXT_INFIX_NEG^# } // S4_EXT_INFIX: Begin completions // S4_EXT_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: + {#S4#}[#S4#] @@ -383,7 +321,7 @@ func testExtInfix2(x: S4) { // S4_EXT_INFIX_NEG-NOT: &&& func testExtInfix3(x: S4) { - x + x#^EXT_INFIX_3^# + x + x#^EXT_INFIX_3?check=S4_EXT_INFIX_SIMPLE^# } // S4_EXT_INFIX_SIMPLE: Begin completions // S4_EXT_INFIX_SIMPLE-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: + {#S4#}[#S4#] @@ -391,7 +329,7 @@ func testExtInfix3(x: S4) { // S4_EXT_INFIX_SIMPLE: End completions func testExtInfix4(x: S4) { - 1 + 1.0 + x#^EXT_INFIX_4^# + 1 + 1.0 + x#^EXT_INFIX_4?check=S4_EXT_INFIX_SIMPLE^# } func testAssignTuple1() { @@ -399,7 +337,7 @@ func testAssignTuple1() { } func testAssignTuple3() { func void() {} - void()#^ASSIGN_TUPLE_3^# + void()#^ASSIGN_TUPLE_3?check=ASSIGN_TUPLE_1^# } // FIXME: technically this is sometimes legal, but we would need to // differentiate between cases like () = and print() =. Since it's not very @@ -424,9 +362,9 @@ func ||||(x: Boolish, y: @autoclosure ()->Boolish) -> Boolish { return x } func testAutoclosure(x: Boolish, y: Boolish) { if x #^INFIX_AUTOCLOSURE_1^# {} - if x &&&& y #^INFIX_AUTOCLOSURE_2^# {} - if x |||| y #^INFIX_AUTOCLOSURE_3^# {} - if x &&&& x |||| y #^INFIX_AUTOCLOSURE_4^# {} + if x &&&& y #^INFIX_AUTOCLOSURE_2?check=INFIX_AUTOCLOSURE_1^# {} + if x |||| y #^INFIX_AUTOCLOSURE_3?check=INFIX_AUTOCLOSURE_1^# {} + if x &&&& x |||| y #^INFIX_AUTOCLOSURE_4?check=INFIX_AUTOCLOSURE_1^# {} } // INFIX_AUTOCLOSURE_1: Begin completions @@ -434,3 +372,4 @@ func testAutoclosure(x: Boolish, y: Boolish) { // INFIX_AUTOCLOSURE_1-DAG: Decl[InfixOperatorFunction]/CurrModule: [' ']==== {#Boolish#}[#Boolish#]; // INFIX_AUTOCLOSURE_1-DAG: Decl[InfixOperatorFunction]/CurrModule: [' ']|||| {#Boolish#}[#Boolish#]; // INFIX_AUTOCLOSURE_1: End completions + diff --git a/test/IDE/complete_unresolved_members.swift b/test/IDE/complete_unresolved_members.swift index 0ffda8a834c26..5655a10887505 100644 --- a/test/IDE/complete_unresolved_members.swift +++ b/test/IDE/complete_unresolved_members.swift @@ -1,133 +1,7 @@ -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_1 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_2 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_3 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_4 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_5 | %FileCheck %s -check-prefix=UNRESOLVED_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_6 | %FileCheck %s -check-prefix=UNRESOLVED_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_7 | %FileCheck %s -check-prefix=UNRESOLVED_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_10 | %FileCheck %s -check-prefix=UNRESOLVED_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_11 | %FileCheck %s -check-prefix=UNRESOLVED_2 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_8 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_9 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_OPT_1 | %FileCheck %s -check-prefix=UNRESOLVED_3_OPT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_OPT_2 | %FileCheck %s -check-prefix=UNRESOLVED_3_OPT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_OPT_3 | %FileCheck %s -check-prefix=UNRESOLVED_3_OPTOPTOPT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_OPT_4 | %FileCheck %s -check-prefix=UNRESOLVED_OPT_4 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_12 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_13 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_14 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_15 | %FileCheck %s -check-prefix=UNRESOLVED_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_16 | %FileCheck %s -check-prefix=UNRESOLVED_4 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_17 | %FileCheck %s -check-prefix=UNRESOLVED_4 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_18 | %FileCheck %s -check-prefix=UNRESOLVED_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_19 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_20 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_21 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_22 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_22_noreturn | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_23 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_24 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_25 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_26 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_27 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_27_NOCRASH > /dev/null -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_28 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_29 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_30 | %FileCheck %s -check-prefix=UNRESOLVED_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_31 | %FileCheck %s -check-prefix=UNRESOLVED_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_32 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_33 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_34 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_35 | %FileCheck %s -check-prefix=UNRESOLVED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_36 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_37 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_38 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_39 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_40 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_41 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_42 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_43 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_44 | %FileCheck %s -check-prefix=UNRESOLVED_3 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_AVAIL_1 | %FileCheck %s -check-prefix=ENUM_AVAIL_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OPTIONS_AVAIL_1 | %FileCheck %s -check-prefix=OPTIONS_AVAIL_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_LITERAL_1 | %FileCheck %s -check-prefix=WITH_LITERAL_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_LITERAL_2 | %FileCheck %s -check-prefix=WITH_LITERAL_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_LITERAL_3 | %FileCheck %s -check-prefix=WITH_LITERAL_3 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INVALID_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OTHER_FILE_1 %S/Inputs/EnumFromOtherFile.swift | %FileCheck %s -check-prefix=OTHER_FILE_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NON_OPT_SET_1 | %FileCheck %s -check-prefix=NON_OPT_SET_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NON_OPT_SET_2 | %FileCheck %s -check-prefix=NON_OPT_SET_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NON_OPT_SET_3 | %FileCheck %s -check-prefix=NON_OPT_SET_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRING_INTERPOLATION_1 | %FileCheck %s -check-prefix=STRING_INTERPOLATION_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRING_INTERPOLATION_INVALID - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUBTYPE_1 | %FileCheck %s -check-prefix=SUBTYPE_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUBTYPE_2 | %FileCheck %s -check-prefix=SUBTYPE_2 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_1 | %FileCheck %s -check-prefix=GENERIC_1_INT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_2 | %FileCheck %s -check-prefix=GENERIC_1_INT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_3 | %FileCheck %s -check-prefix=GENERIC_1_U -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_4 | %FileCheck %s -check-prefix=GENERIC_1_INT - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STATIC_CLOSURE_1 | %FileCheck %s -check-prefix=STATIC_CLOSURE_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADED_METHOD_1 | %FileCheck %s -check-prefix=OVERLOADED_METHOD_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADED_INIT_1 | %FileCheck %s -check-prefix=OVERLOADED_METHOD_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADED_INIT_2 | %FileCheck %s -check-prefix=OVERLOADED_METHOD_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_1 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_2 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_3 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_4 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_5 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_6 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_7 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_8 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_9 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_10 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_11 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_12 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_13 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_14 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_15 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_16 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_17 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_18 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_19 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_20 | %FileCheck %s -check-prefix=GENERICPARAM_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERICPARAM_21 | %FileCheck %s -check-prefix=GENERICPARAM_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DECL_MEMBER_INIT_1 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_1 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_2 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_3 | %FileCheck %s -check-prefix=UNRESOLVED_3 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPEPARAM_IN_CONTEXTTYPE_1 | %FileCheck %s -check-prefix=TYPEPARAM_IN_CONTEXTTYPE_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TERNARY_1 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TERNARY_2 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TERNARY_3 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TERNARY_4 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TERNARY_5 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TERNARY_6 | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TERNARY_CONDITION | %FileCheck %s -check-prefix=TERNARY_CONDITION -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOADED_CLOSURE_RETURN | %FileCheck %s -check-prefix=OVERLOADED_CLOSURE_RETURN -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE_OPT | %FileCheck %s -check-prefix=UNRESOLVED_3_OPT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE_FUNCTY | %FileCheck %s -check-prefix=UNRESOLVED_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE_FUNCTY_OPT | %FileCheck %s -check-prefix=UNRESOLVED_3_OPT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUGAR_TYPE | %FileCheck %s -check-prefix=SUGAR_TYPE +// RUN: %empty-directory(%t) +// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s %S/Inputs/EnumFromOtherFile.swift -filecheck %raw-FileCheck -completion-output-dir %t + +// NOCRASH: Token enum SomeEnum1 { case South @@ -207,19 +81,19 @@ class C1 { } func f2() { var f : SomeOptions1 - f = [.#^UNRESOLVED_2^# + f = [.#^UNRESOLVED_2?check=UNRESOLVED_1^# } func f3() { var f : SomeOptions1 - f = [.Option1, .#^UNRESOLVED_3^# + f = [.Option1, .#^UNRESOLVED_3?check=UNRESOLVED_1^# } } class C2 { func f1() { - OptionSetTaker1(.#^UNRESOLVED_4^#) + OptionSetTaker1(.#^UNRESOLVED_4?check=UNRESOLVED_1^#) } func f2() { - OptionSetTaker1([.Option1, .#^UNRESOLVED_5^#]) + OptionSetTaker1([.Option1, .#^UNRESOLVED_5?check=UNRESOLVED_1^#]) } // UNRESOLVED_1: Begin completions // UNRESOLVED_1-NOT: SomeEnum1 @@ -233,10 +107,10 @@ class C2 { class C3 { func f1() { - OptionSetTaker2(.#^UNRESOLVED_6^#) + OptionSetTaker2(.#^UNRESOLVED_6?check=UNRESOLVED_2^#) } func f2() { - OptionSetTaker2([.Option4, .#^UNRESOLVED_7^#]) + OptionSetTaker2([.Option4, .#^UNRESOLVED_7?check=UNRESOLVED_2^#]) } // UNRESOLVED_2: Begin completions // UNRESOLVED_2-NOT: SomeEnum1 @@ -250,22 +124,22 @@ class C3 { class C4 { func f1() { var E : SomeEnum1 - E = .#^UNRESOLVED_8^# + E = .#^UNRESOLVED_8?check=UNRESOLVED_3^# } func f2() { - EnumTaker1(.#^UNRESOLVED_9^#) + EnumTaker1(.#^UNRESOLVED_9?check=UNRESOLVED_3^#) } func f3() { - OptionSetTaker5(.Option1, .Option4, .#^UNRESOLVED_12^#, .West) + OptionSetTaker5(.Option1, .Option4, .#^UNRESOLVED_12?check=UNRESOLVED_3^#, .West) } func f4() { - var _: SomeEnum1? = .#^UNRESOLVED_OPT_1^# + var _: SomeEnum1? = .#^UNRESOLVED_OPT_1?check=UNRESOLVED_3_OPT^# } func f5() { - optionalEnumTaker1(.#^UNRESOLVED_OPT_2^#) + optionalEnumTaker1(.#^UNRESOLVED_OPT_2?check=UNRESOLVED_3_OPT^#) } func f6() { - var _: SomeEnum1??? = .#^UNRESOLVED_OPT_3^# + var _: SomeEnum1??? = .#^UNRESOLVED_OPT_3?check=UNRESOLVED_3_OPTOPTOPT^# } } @@ -331,26 +205,26 @@ func testOptionalWithCustomExtension() { class C5 { func f1() { - OptionSetTaker3(.Option1, .#^UNRESOLVED_10^#) + OptionSetTaker3(.Option1, .#^UNRESOLVED_10?check=UNRESOLVED_2^#) } func f2() { - OptionSetTaker4(.#^UNRESOLVED_11^#, .Option1) + OptionSetTaker4(.#^UNRESOLVED_11?check=UNRESOLVED_2^#, .Option1) } } -OptionSetTaker5(.Option1, .Option4, .#^UNRESOLVED_13^#, .West) -OptionSetTaker5(.#^UNRESOLVED_14^#, .Option4, .South, .West) -OptionSetTaker5([.#^UNRESOLVED_15^#], .Option4, .South, .West) +OptionSetTaker5(.Option1, .Option4, .#^UNRESOLVED_13?check=UNRESOLVED_3^#, .West) +OptionSetTaker5(.#^UNRESOLVED_14?check=UNRESOLVED_1^#, .Option4, .South, .West) +OptionSetTaker5([.#^UNRESOLVED_15?check=UNRESOLVED_1^#], .Option4, .South, .West) -OptionSetTaker6(.#^UNRESOLVED_16^#, .Option4) -OptionSetTaker6(.Option4, .#^UNRESOLVED_17^#,) +OptionSetTaker6(.#^UNRESOLVED_16?check=UNRESOLVED_4^#, .Option4) +OptionSetTaker6(.Option4, .#^UNRESOLVED_17?check=UNRESOLVED_4^#,) var a = {() in - OptionSetTaker5([.#^UNRESOLVED_18^#], .Option4, .South, .West) + OptionSetTaker5([.#^UNRESOLVED_18?check=UNRESOLVED_1^#], .Option4, .South, .West) } var Container = OptionTakerContainer1() -Container.OptionSetTaker1(.#^UNRESOLVED_19^#) -Container.EnumTaker1(.#^UNRESOLVED_20^# +Container.OptionSetTaker1(.#^UNRESOLVED_19?check=UNRESOLVED_1^#) +Container.EnumTaker1(.#^UNRESOLVED_20?check=UNRESOLVED_3^# func parserSync() {} @@ -362,30 +236,30 @@ func parserSync() {} // UNRESOLVED_4-NOT: Option5 // UNRESOLVED_4-NOT: Option6 -var OpIns1 : SomeOptions1 = .#^UNRESOLVED_21^# +var OpIns1 : SomeOptions1 = .#^UNRESOLVED_21?check=UNRESOLVED_1^# var c1 = {() -> SomeOptions1 in - return .#^UNRESOLVED_22^# + return .#^UNRESOLVED_22?check=UNRESOLVED_1^# } var c1_noreturn = {() -> SomeOptions1 in - .#^UNRESOLVED_22_noreturn^# + .#^UNRESOLVED_22_noreturn?check=UNRESOLVED_1^# } class C6 { func f1() -> SomeOptions1 { - return .#^UNRESOLVED_23^# + return .#^UNRESOLVED_23?check=UNRESOLVED_1^# } func f2(p : SomeEnum3) { switch p { - case .Payload(.#^UNRESOLVED_24^#) + case .Payload(.#^UNRESOLVED_24?check=UNRESOLVED_3^#) } } } class C6 { func f1(e: SomeEnum1) { - if let x = Optional(e) where x == .#^UNRESOLVED_25^# + if let x = Optional(e) where x == .#^UNRESOLVED_25?check=UNRESOLVED_3^# } } class C7 {} @@ -394,39 +268,39 @@ extension C7 { } var cInst1 = C7() -cInst1.extendedf1(.#^UNRESOLVED_26^# +cInst1.extendedf1(.#^UNRESOLVED_26?check=UNRESOLVED_3^# func nocrash1() -> SomeEnum1 { - return .#^UNRESOLVED_27_NOCRASH^# + return .#^UNRESOLVED_27_NOCRASH?check=NOCRASH^# } func resetParser1() {} func f() -> SomeEnum1 { - return .#^UNRESOLVED_27^# + return .#^UNRESOLVED_27?check=UNRESOLVED_3^# } -let TopLevelVar1 = OptionSetTaker7([.#^UNRESOLVED_28^#], [.Option4]) +let TopLevelVar1 = OptionSetTaker7([.#^UNRESOLVED_28?check=UNRESOLVED_1^#], [.Option4]) -let TopLevelVar2 = OptionSetTaker1([.#^UNRESOLVED_29^#]) +let TopLevelVar2 = OptionSetTaker1([.#^UNRESOLVED_29?check=UNRESOLVED_1^#]) -let TopLevelVar3 = OptionSetTaker7([.Option1], [.#^UNRESOLVED_30^#]) -let TopLevelVar4 = OptionSetTaker7([.Option1], [.Option4, .#^UNRESOLVED_31^#]) +let TopLevelVar3 = OptionSetTaker7([.Option1], [.#^UNRESOLVED_30?check=UNRESOLVED_2^#]) +let TopLevelVar4 = OptionSetTaker7([.Option1], [.Option4, .#^UNRESOLVED_31?check=UNRESOLVED_2^#]) -let _: [SomeEnum1] = [.#^UNRESOLVED_32^#] -let _: [SomeEnum1] = [.South, .#^UNRESOLVED_33^#] -let _: [SomeEnum1] = [.South, .#^UNRESOLVED_34^# .South] +let _: [SomeEnum1] = [.#^UNRESOLVED_32?check=UNRESOLVED_3^#] +let _: [SomeEnum1] = [.South, .#^UNRESOLVED_33?check=UNRESOLVED_3^#] +let _: [SomeEnum1] = [.South, .#^UNRESOLVED_34?check=UNRESOLVED_3^# .South] -let _: [SomeEnum1:SomeOptions1] = [.South:.Option1, .South:.#^UNRESOLVED_35^#] -let _: [SomeEnum1:SomeOptions1] = [.South:.Option1, .#^UNRESOLVED_36^#:.Option1] -let _: [SomeEnum1:SomeOptions1] = [.South:.Option1, .#^UNRESOLVED_37^#] -let _: [SomeEnum1:SomeOptions1] = [.South:.Option1, .#^UNRESOLVED_38^#:] -let _: [SomeEnum1:SomeOptions1] = [.#^UNRESOLVED_39^#] -let _: [SomeEnum1:SomeOptions1] = [.#^UNRESOLVED_40^#:] -let _: [SomeEnum1:SomeEnum3] = [.South:.Payload(.South), .South: .Payload(.#^UNRESOLVED_41^#)] -let _: [SomeEnum3:SomeEnum1] = [.Payload(.South):.South, .Payload(.#^UNRESOLVED_42^#):.South] -let _: [SomeEnum3:SomeEnum1] = [.Payload(.South):.South, .Payload(.#^UNRESOLVED_43^#):] -let _: [SomeEnum3:SomeEnum1] = [.Payload(.South):.South, .Payload(.#^UNRESOLVED_44^#)] +let _: [SomeEnum1:SomeOptions1] = [.South:.Option1, .South:.#^UNRESOLVED_35?check=UNRESOLVED_1^#] +let _: [SomeEnum1:SomeOptions1] = [.South:.Option1, .#^UNRESOLVED_36?check=UNRESOLVED_3^#:.Option1] +let _: [SomeEnum1:SomeOptions1] = [.South:.Option1, .#^UNRESOLVED_37?check=UNRESOLVED_3^#] +let _: [SomeEnum1:SomeOptions1] = [.South:.Option1, .#^UNRESOLVED_38?check=UNRESOLVED_3^#:] +let _: [SomeEnum1:SomeOptions1] = [.#^UNRESOLVED_39?check=UNRESOLVED_3^#] +let _: [SomeEnum1:SomeOptions1] = [.#^UNRESOLVED_40?check=UNRESOLVED_3^#:] +let _: [SomeEnum1:SomeEnum3] = [.South:.Payload(.South), .South: .Payload(.#^UNRESOLVED_41?check=UNRESOLVED_3^#)] +let _: [SomeEnum3:SomeEnum1] = [.Payload(.South):.South, .Payload(.#^UNRESOLVED_42?check=UNRESOLVED_3^#):.South] +let _: [SomeEnum3:SomeEnum1] = [.Payload(.South):.South, .Payload(.#^UNRESOLVED_43?check=UNRESOLVED_3^#):] +let _: [SomeEnum3:SomeEnum1] = [.Payload(.South):.South, .Payload(.#^UNRESOLVED_44?check=UNRESOLVED_3^#)] func testAvail1(_ x: EnumAvail1) { testAvail1(.#^ENUM_AVAIL_1^#) @@ -473,7 +347,7 @@ func testWithLiteral2() { func takeEnum(thing: MyEnum, other: Double) {} } let s: S - _ = s.takeEnum(thing: .#^WITH_LITERAL_2^#, other: 1.0) + _ = s.takeEnum(thing: .#^WITH_LITERAL_2?check=WITH_LITERAL_1^#, other: 1.0) } func testWithLiteral3() { struct S { @@ -494,7 +368,7 @@ func testWithLiteral3() { func testInvalid1() { func invalid() -> NoSuchEnum { - return .#^INVALID_1^# // Don't crash. + return .#^INVALID_1?check=NOCRASH^# // Don't crash. } } @@ -532,18 +406,18 @@ func testNonOptSet() { // NON_OPT_SET_1: End completions func testNonOptSet() { - let x: NonOptSet = .#^NON_OPT_SET_2^# + let x: NonOptSet = .#^NON_OPT_SET_2?check=NON_OPT_SET_1^# } func testNonOptSet() -> NonOptSet { - return .#^NON_OPT_SET_3^# + return .#^NON_OPT_SET_3?check=NON_OPT_SET_1^# } func testInStringInterpolation() { enum MyEnum { case foo, bar } func takeEnum(_ e: MyEnum) -> MyEnum { return e } let x = "enum: \(takeEnum(.#^STRING_INTERPOLATION_1^#))" - let y = "enum: \(.#^STRING_INTERPOLATION_INVALID^#)" // Dont'crash. + let y = "enum: \(.#^STRING_INTERPOLATION_INVALID?check=NOCRASH^#)" // Dont'crash. } // STRING_INTERPOLATION_1: Begin completions // STRING_INTERPOLATION_1-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: foo[#MyEnum#]; @@ -587,14 +461,14 @@ func takeGenericInt(_: Generic) { } func takeGenericU(_: Generic) { } func testGeneric() { do { - let _: Generic = .#^GENERIC_1^# + let _: Generic = .#^GENERIC_1?check=GENERIC_1_INT^# } - takeGenericInt(.#^GENERIC_2^#) - takeGenericU(.#^GENERIC_3^#) + takeGenericInt(.#^GENERIC_2?check=GENERIC_1_INT^#) + takeGenericU(.#^GENERIC_3?check=GENERIC_1_U^#) } switch Generic.empty { -case let .#^GENERIC_4^# +case let .#^GENERIC_4?check=GENERIC_1_INT^# } // GENERIC_1_INT: Begin completions // GENERIC_1_INT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: contains({#content: Int#})[#Generic#]; @@ -639,10 +513,10 @@ func testOverload(val: HasOverloaded) { // OVERLOADED_METHOD_1-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): SomeEnum2#})[#(into: inout Hasher) -> Void#]; // OVERLOADED_METHOD_1: End completions - let _ = HasOverloaded.init(e: .#^OVERLOADED_INIT_1^#) + let _ = HasOverloaded.init(e: .#^OVERLOADED_INIT_1?check=OVERLOADED_METHOD_1^#) // Same as OVERLOADED_METHOD_1. - let _ = HasOverloaded(e: .#^OVERLOADED_INIT_2^#) + let _ = HasOverloaded(e: .#^OVERLOADED_INIT_2?check=OVERLOADED_METHOD_1^#) // Same as OVERLOADED_METHOD_1. } @@ -658,35 +532,35 @@ func testingGenericParam1(x: inout T, fn: (T) -> Void) -> T { /* Parser sync. */; - let _: (Int, T) = (1, .#^GENERICPARAM_2^#) + let _: (Int, T) = (1, .#^GENERICPARAM_2?check=GENERICPARAM_1^#) // Same as GENERICPARAM_1. - (_, x) = (1, .#^GENERICPARAM_3^#) + (_, x) = (1, .#^GENERICPARAM_3?check=GENERICPARAM_1^#) // Same as GENERICPARAM_1. - let _ = fn(.#^GENERICPARAM_4^#) + let _ = fn(.#^GENERICPARAM_4?check=GENERICPARAM_1^#) // Same as GENERICPARAM_1. - let _ = receiveHasStatic(x: .#^GENERICPARAM_5^#) + let _ = receiveHasStatic(x: .#^GENERICPARAM_5?check=GENERICPARAM_1^#) // Same as GENERICPARAM_1. let _ = { () -> T in - return .#^GENERICPARAM_6^# + return .#^GENERICPARAM_6?check=GENERICPARAM_1^# // Same as GENERICPARAM_1. } let _: () -> T = { - return .#^GENERICPARAM_7^# + return .#^GENERICPARAM_7?check=GENERICPARAM_1^# // Same as GENERICPARAM_1. } let _ = { (_: InvalidTy) -> T in - return .#^GENERICPARAM_8^# + return .#^GENERICPARAM_8?check=GENERICPARAM_1^# // Same as GENERICPARAM_1. } - if case .#^GENERICPARAM_9^# = x {} + if case .#^GENERICPARAM_9?check=GENERICPARAM_1^# = x {} // Same as GENERICPARAM_1. - return .#^GENERICPARAM_10^# + return .#^GENERICPARAM_10?check=GENERICPARAM_1^# // Same as GENERICPARAM_1. } @@ -695,53 +569,53 @@ class C { var t: T = .instance func foo(x: T) -> T { - return .#^GENERICPARAM_11^# + return .#^GENERICPARAM_11?check=GENERICPARAM_1^# // Same as GENERICPARAM_1. } func bar(x: U) -> U { - return .#^GENERICPARAM_12^# + return .#^GENERICPARAM_12?check=GENERICPARAM_1^# // Same as GENERICPARAM_1. } func testing() { - let _ = foo(x: .#^GENERICPARAM_13^#) + let _ = foo(x: .#^GENERICPARAM_13?check=GENERICPARAM_1^#) // Same as GENERICPARAM_1. - let _ = bar(x: .#^GENERICPARAM_14^#) + let _ = bar(x: .#^GENERICPARAM_14?check=GENERICPARAM_1^#) // Same as GENERICPARAM_1. - t = .#^GENERICPARAM_15^# + t = .#^GENERICPARAM_15?check=GENERICPARAM_1^# // Same as GENERICPARAM_1. /* Parser sync. */; func sync1() {} - self.t = .#^GENERICPARAM_16^# + self.t = .#^GENERICPARAM_16?check=GENERICPARAM_1^# // Same as GENERICPARAM_1. /* Parser sync. */; func sync2() {} - (_, t) = (1, .#^GENERICPARAM_17^#) + (_, t) = (1, .#^GENERICPARAM_17?check=GENERICPARAM_1^#) // Same as GENERICPARAM_1. - (_, self.t) = (1, .#^GENERICPARAM_18^#) + (_, self.t) = (1, .#^GENERICPARAM_18?check=GENERICPARAM_1^#) // Same as GENERICPARAM_1. } } func testingGenericParam2(obj: C) { - let _ = obj.foo(x: .#^GENERICPARAM_19^#) + let _ = obj.foo(x: .#^GENERICPARAM_19?check=GENERICPARAM_1^#) // Same as GENERICPARAM_1. - let _ = obj.bar(x: .#^GENERICPARAM_20^#) + let _ = obj.bar(x: .#^GENERICPARAM_20?check=GENERICPARAM_1^#) // Same as GENERICPARAM_1. - obj.t = .#^GENERICPARAM_21^# + obj.t = .#^GENERICPARAM_21?check=GENERICPARAM_1^# // Same as GENERICPARAM_1. } struct TestingStruct { - var value: SomeEnum1 = .#^DECL_MEMBER_INIT_1^# + var value: SomeEnum1 = .#^DECL_MEMBER_INIT_1?check=UNRESOLVED_3^# } -func testDefaultArgument(arg: SomeEnum1 = .#^DEFAULT_ARG_1^#) {} +func testDefaultArgument(arg: SomeEnum1 = .#^DEFAULT_ARG_1?check=UNRESOLVED_3^#) {} class TestDefalutArg { - func method(arg: SomeEnum1 = .#^DEFAULT_ARG_2^#) {} - init(arg: SomeEnum1 = .#^DEFAULT_ARG_3^#) {} + func method(arg: SomeEnum1 = .#^DEFAULT_ARG_2?check=UNRESOLVED_3^#) {} + init(arg: SomeEnum1 = .#^DEFAULT_ARG_3?check=UNRESOLVED_3^#) {} } @@ -768,19 +642,19 @@ func testTypeParamInContextType() { } func testTernaryOperator(cond: Bool) { - let _: SomeEnum1 = cond ? .#^TERNARY_1^# + let _: SomeEnum1 = cond ? .#^TERNARY_1?check=UNRESOLVED_3^# func sync(){} - let _: SomeEnum1 = cond ? .#^TERNARY_2^# : + let _: SomeEnum1 = cond ? .#^TERNARY_2?check=UNRESOLVED_3^# : func sync(){} - let _: SomeEnum1 = cond ? .#^TERNARY_3^# : .South + let _: SomeEnum1 = cond ? .#^TERNARY_3?check=UNRESOLVED_3^# : .South func sync(){} - let _: SomeEnum1 = cond ? .South : .#^TERNARY_4^# + let _: SomeEnum1 = cond ? .South : .#^TERNARY_4?check=UNRESOLVED_3^# } func testTernaryOperator2(cond: Bool) { - let _: SomeEnum1 = cond ? .#^TERNARY_5^# : .bogus + let _: SomeEnum1 = cond ? .#^TERNARY_5?check=UNRESOLVED_3^# : .bogus func sync(){} - let _: SomeEnum1 = cond ? .bogus : .#^TERNARY_6^# + let _: SomeEnum1 = cond ? .bogus : .#^TERNARY_6?check=UNRESOLVED_3^# func sync(){} let _: SomeEnum1 = .#^TERNARY_CONDITION^# ? .bogus : .bogus // TERNARY_CONDITION: Begin completions @@ -807,16 +681,16 @@ func testClosureReturnTypeForOverloaded() { func receiveAutoclosure(_: @autoclosure () -> SomeEnum1) {} func receiveAutoclosureOpt(_: @autoclosure () -> SomeEnum1?) {} func testAutoclosre() { - receiveAutoclosure(.#^AUTOCLOSURE^#) + receiveAutoclosure(.#^AUTOCLOSURE?check=UNRESOLVED_3^#) // Same as UNRESOLVED_3 - receiveAutoclosureOpt(.#^AUTOCLOSURE_OPT^#) + receiveAutoclosureOpt(.#^AUTOCLOSURE_OPT?check=UNRESOLVED_3_OPT^#) // Same as UNRESOLVED_3_OPT } func testAutoclosreFuncTy(fn: (@autoclosure () -> SomeEnum1) -> Void, fnOpt: (@autoclosure () -> SomeEnum1?) -> Void) { - fn(.#^AUTOCLOSURE_FUNCTY^#) + fn(.#^AUTOCLOSURE_FUNCTY?check=UNRESOLVED_3^#) // Same as UNRESOLVED_3 - fnOpt(.#^AUTOCLOSURE_FUNCTY_OPT^#) + fnOpt(.#^AUTOCLOSURE_FUNCTY_OPT?check=UNRESOLVED_3_OPT^#) // Same as UNRESOLVED_3_OPT } @@ -843,3 +717,4 @@ func testSameType() { // SUGAR_TYPE-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem/TypeRelation[Invalid]: hash({#(self): Optional#})[#(into: inout Hasher) -> Void#]; // SUGAR_TYPE: End completions } + diff --git a/test/IDE/complete_value_expr.swift b/test/IDE/complete_value_expr.swift index cdbc8fbe3e014..61261f8df6f87 100644 --- a/test/IDE/complete_value_expr.swift +++ b/test/IDE/complete_value_expr.swift @@ -1,213 +1,13 @@ -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_3 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_4 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_5 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_NO_DOT_1 | %FileCheck %s -check-prefix=FOO_OBJECT_NO_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_NO_DOT_2 | %FileCheck %s -check-prefix=FOO_OBJECT_NO_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_STRUCT_DOT_1 | %FileCheck %s -check-prefix=FOO_STRUCT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_STRUCT_NO_DOT_1 | %FileCheck %s -check-prefix=FOO_STRUCT_NO_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_STRUCT_META_1 | %FileCheck %s -check-prefix=FOO_STRUCT_META -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_STRUCT_META_2 | %FileCheck %s -check-prefix=FOO_STRUCT_META - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_FUNC_0 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_FUNC_0 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_FUNC_1 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_FUNC_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_FUNC_2 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_FUNC_2 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_VARARG_FUNC_0 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_VARARG_FUNC_0 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_VARARG_FUNC_1 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_VARARG_FUNC_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_VARARG_FUNC_2 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_VARARG_FUNC_2 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_OVERLOADED_FUNC_1 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_OVERLOADED_FUNC_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_OVERLOADED_FUNC_2 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_OVERLOADED_FUNC_2 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_1 | %FileCheck %s -check-prefix=IN_SWITCH_CASE -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_2 | %FileCheck %s -check-prefix=IN_SWITCH_CASE -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_3 | %FileCheck %s -check-prefix=IN_SWITCH_CASE -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_4 | %FileCheck %s -check-prefix=IN_SWITCH_CASE - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=VF1 | %FileCheck %s -check-prefix=VF1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=VF2 | %FileCheck %s -check-prefix=VF2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BASE_MEMBERS | %FileCheck %s -check-prefix=BASE_MEMBERS -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BASE_MEMBERS_STATIC | %FileCheck %s -check-prefix=BASE_MEMBERS_STATIC - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_NO_DOT_1 | %FileCheck %s -check-prefix=PROTO_MEMBERS_NO_DOT_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_NO_DOT_2 | %FileCheck %s -check-prefix=PROTO_MEMBERS_NO_DOT_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_NO_DOT_3 | %FileCheck %s -check-prefix=PROTO_MEMBERS_NO_DOT_3 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_1 | %FileCheck %s -check-prefix=PROTO_MEMBERS_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_2 | %FileCheck %s -check-prefix=PROTO_MEMBERS_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_3 | %FileCheck %s -check-prefix=PROTO_MEMBERS_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_4 | %FileCheck %s -check-prefix=PROTO_MEMBERS_4 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_0 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_0 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_1 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_2 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_3 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_4 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_4 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_5 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_5 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_6 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_6 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_7 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_7 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_8 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_8 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_9 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_9 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_10 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_10 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_11 -code-complete-call-pattern-heuristics | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_11 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_11 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_4 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_12 -code-complete-call-pattern-heuristics | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_12 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_12 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_4 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_VARARG_FUNCTION_CALL_1 | %FileCheck %s -check-prefix=INSIDE_VARARG_FUNCTION_CALL_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_VARARG_FUNCTION_CALL_2 | %FileCheck %s -check-prefix=INSIDE_VARARG_FUNCTION_CALL_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_VARARG_FUNCTION_CALL_3 | %FileCheck %s -check-prefix=INSIDE_VARARG_FUNCTION_CALL_3 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_OVERLOADED_FUNCTION_CALL_1 | %FileCheck %s -check-prefix=INSIDE_OVERLOADED_FUNCTION_CALL_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_ON_CLASS_INSTANCE_1 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_ON_CLASS_INSTANCE_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_3 | %FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_4 | %FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_4 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_5 | %FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_5 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_6 | %FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_6 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CONSTRUCTOR_PARAM_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CONSTRUCTOR_PARAM_2 | %FileCheck %s -check-prefix=RESOLVE_CONSTRUCTOR_PARAM_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CONSTRUCTOR_PARAM_3 | %FileCheck %s -check-prefix=RESOLVE_CONSTRUCTOR_PARAM_3 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_PAREN_PATTERN_1 | %FileCheck %s -check-prefix=FUNC_PAREN_PATTERN_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_PAREN_PATTERN_2 | %FileCheck %s -check-prefix=FUNC_PAREN_PATTERN_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_PAREN_PATTERN_3 | %FileCheck %s -check-prefix=FUNC_PAREN_PATTERN_3 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHAINED_CALLS_1 | %FileCheck %s -check-prefix=CHAINED_CALLS_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHAINED_CALLS_2 | %FileCheck %s -check-prefix=CHAINED_CALLS_2 - -// Disabled because we aren't handling failures well. -// FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHAINED_CALLS_3 | %FileCheck %s -check-prefix=CHAINED_CALLS_3 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_1 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_2 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_3 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_4 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_4 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_5 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_5 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_ERROR_1 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_ERROR_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_1_STATIC | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_1_STATIC -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_2_STATIC | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_2_STATIC -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_3_STATIC | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_3_STATIC -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_4_STATIC | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_4_STATIC -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_5_STATIC | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_5_STATIC - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_1 | %FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_2 | %FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_3 | %FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_4 | %FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_4 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_MODULES_1 | %FileCheck %s -check-prefix=RESOLVE_MODULES_1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INTERPOLATED_STRING_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_WILLCONFORMP1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_WILLCONFORMP1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DIDCONFORMP2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_DIDCONFORMP2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DIDCONFORMP3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_DIDCONFORMP3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ1 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ2 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ3 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ4 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ5 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ6 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_TYPE1 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_TYPE1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_TYPE2 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_TYPE2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_TYPE3 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_TYPE3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_NODOT1 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_NODOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_NODOT2 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_NODOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NODUP_RESTATED_REQ_NODOT3 | %FileCheck %s -check-prefix=CHECK_NODUP_RESTATED_REQ_NODOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHECK_PROT_OVERRIDES1 | %FileCheck %s -check-prefix=CHECK_PROT_OVERRIDES -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHECK_PROT_OVERRIDES2 | %FileCheck %s -check-prefix=CHECK_PROT_OVERRIDES -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE1_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE1_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE3_SUB | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME_SUB -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE4 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_3_SUB | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME_SUB -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE2_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE2_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_TA_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_TA -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_TA_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_TA -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_4 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT_4 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_5 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT_5 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_DOT_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_DOT_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_T_DOT_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_T_DOT_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_UNUSABLE_EXISTENTIAL | %FileCheck %s -check-prefix=PROTOCOL_EXT_UNUSABLE_EXISTENTIAL -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DEDUP_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_DEDUP_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DEDUP_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_DEDUP_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DEDUP_3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_DEDUP_3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=THROWS1 | %FileCheck %s -check-prefix=THROWS1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=THROWS2 | %FileCheck %s -check-prefix=THROWS2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_THROWS1 | %FileCheck %s -check-prefix=MEMBER_THROWS1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_THROWS2 | %FileCheck %s -check-prefix=MEMBER_THROWS2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_THROWS3 | %FileCheck %s -check-prefix=MEMBER_THROWS3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_THROWS1 | %FileCheck %s -check-prefix=INIT_THROWS1 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE1 > %t.autoclosure1 -// RUN: %FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE2 > %t.autoclosure2 -// RUN: %FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE3 > %t.autoclosure3 -// RUN: %FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure3 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE4 > %t.autoclosure4 -// RUN: %FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure4 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE5 > %t.autoclosure5 -// RUN: %FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure5 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_1 | %FileCheck %s -check-prefix=GENERIC_TYPEALIAS_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_2 | %FileCheck %s -check-prefix=GENERIC_TYPEALIAS_2 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPRECATED_1 | %FileCheck %s -check-prefix=DEPRECATED_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DOT_EXPR_NON_NOMINAL_1 | %FileCheck %s -check-prefix=DOT_EXPR_NON_NOMINAL_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DOT_EXPR_NON_NOMINAL_2 | %FileCheck %s -check-prefix=DOT_EXPR_NON_NOMINAL_2 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD_1 | %FileCheck %s -check-prefix=KEYWORD_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD_2 | %FileCheck %s -check-prefix=KEYWORD_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD_3 | %FileCheck %s -check-prefix=KEYWORD_3 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOLTYPE_DOT_1 | %FileCheck %s -check-prefix=PROTOCOLTYPE_DOT_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOLTYPE_DOT_2 | %FileCheck %s -check-prefix=PROTOCOLTYPE_DOT_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOLTYPE_DOT_3 | %FileCheck %s -check-prefix=PROTOCOLTYPE_DOT_3 - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_MEMBERDECLINIT_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_MEMBERDECLINIT_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_MEMBERDECLINIT_3 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_ARRAY_LITERAL_1 | %FileCheck %s -check-prefix=SIMPLE_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_ARRAY_LITERAL_2 | %FileCheck %s -check-prefix=SIMPLE_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_DICTIONARY_LITERAL_1 | %FileCheck %s -check-prefix=SIMPLE_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_DICTIONARY_LITERAL_2 | %FileCheck %s -check-prefix=SIMPLE_OBJECT_DOT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE_CALL_RESULT | %FileCheck %s -check-prefix=COMPLETE_CALL_RESULT -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-keywords=false -code-completion-token=BROKEN_CONFORMANCE | %FileCheck %s -check-prefix=BROKEN_CONFORMANCE - -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOLMETA_1 | %FileCheck %s -check-prefix=PROTOCOLMETA_1 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOLMETA_2 | %FileCheck %s -check-prefix=PROTOCOLMETA_2 -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOLMETA_3 | %FileCheck %s -check-prefix=PROTOCOLMETA_3 +// RUN: %empty-directory(%t) +// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t // Test code completion of expressions that produce a value. +// NOCRASH: Token + +// NORESULT: Token +// NORESULT-NOT: Begin completions + struct FooStruct { lazy var lazyInstanceVar = 0 var instanceVar = 0 @@ -516,43 +316,43 @@ var fooObject: FooStruct // FOO_STRUCT_NO_DOT-NEXT: End completions func testObjectExpr() { - fooObject.#^FOO_OBJECT_DOT_1^# + fooObject.#^FOO_OBJECT_DOT_1?check=FOO_OBJECT_DOT^# } func testDotDotTokenSplitWithCodeCompletion() { - fooObject.#^FOO_OBJECT_DOT_2^#.bar + fooObject.#^FOO_OBJECT_DOT_2?check=FOO_OBJECT_DOT^#.bar } func testObjectExprBuilderStyle1() { fooObject - .#^FOO_OBJECT_DOT_3^# + .#^FOO_OBJECT_DOT_3?check=FOO_OBJECT_DOT^# } func testObjectExprBuilderStyle2() { fooObject - .builderFunc1(42).#^FOO_OBJECT_DOT_4^# + .builderFunc1(42).#^FOO_OBJECT_DOT_4?check=FOO_OBJECT_DOT^# } func testObjectExprBuilderStyle3() { fooObject .builderFunc1(42) - .#^FOO_OBJECT_DOT_5^# + .#^FOO_OBJECT_DOT_5?check=FOO_OBJECT_DOT^# } func testObjectExprWithoutDot() { - fooObject#^FOO_OBJECT_NO_DOT_1^# + fooObject#^FOO_OBJECT_NO_DOT_1?check=FOO_OBJECT_NO_DOT^# } func testObjectExprWithoutSpaceAfterCodeCompletion() { - fooObject#^FOO_OBJECT_NO_DOT_2^#.bar + fooObject#^FOO_OBJECT_NO_DOT_2?check=FOO_OBJECT_NO_DOT^#.bar } func testMetatypeExpr() { - FooStruct.#^FOO_STRUCT_DOT_1^# + FooStruct.#^FOO_STRUCT_DOT_1?check=FOO_STRUCT_DOT^# } func testMetatypeExprWithoutDot() { - FooStruct#^FOO_STRUCT_NO_DOT_1^# + FooStruct#^FOO_STRUCT_NO_DOT_1?check=FOO_STRUCT_NO_DOT^# } struct NoMetaCompletions { @@ -561,10 +361,10 @@ struct NoMetaCompletions { typealias Foo = Int } func testMetatypeCompletions() { - NoMetaCompletions.Type.#^FOO_STRUCT_META_1^# + NoMetaCompletions.Type.#^FOO_STRUCT_META_1?check=FOO_STRUCT_META^# } func testMetatypeCompletionsWithoutDot() { - NoMetaCompletions.Type#^FOO_STRUCT_META_2^# + NoMetaCompletions.Type#^FOO_STRUCT_META_2?check=FOO_STRUCT_META^# } // FOO_STRUCT_META-NOT: Decl // FOO_STRUCT_META: Keyword[self]/CurrNominal: {{self|.self}}[#NoMetaCompletions.Type.Type#]; name=self @@ -609,15 +409,11 @@ func testImplicitlyCurriedFunc(_ fs: inout FooStruct) { // This call is ambiguous, and the expression is invalid. // Ensure that we don't suggest to call the result. - FooStruct.overloadedInstanceFunc1(&fs)#^IMPLICITLY_CURRIED_OVERLOADED_FUNC_1^# -// IMPLICITLY_CURRIED_OVERLOADED_FUNC_1: found code completion token -// IMPLICITLY_CURRIED_OVERLOADED_FUNC_1-NOT: Begin completions + FooStruct.overloadedInstanceFunc1(&fs)#^IMPLICITLY_CURRIED_OVERLOADED_FUNC_1?check=NORESULT^# // This call is ambiguous, and the expression is invalid. // Ensure that we don't suggest to call the result. - FooStruct.overloadedInstanceFunc2(&fs)#^IMPLICITLY_CURRIED_OVERLOADED_FUNC_2^# -// IMPLICITLY_CURRIED_OVERLOADED_FUNC_2: found code completion token -// IMPLICITLY_CURRIED_OVERLOADED_FUNC_2-NOT: Begin completions + FooStruct.overloadedInstanceFunc2(&fs)#^IMPLICITLY_CURRIED_OVERLOADED_FUNC_2?check=NORESULT^# } //===--- @@ -626,19 +422,19 @@ func testImplicitlyCurriedFunc(_ fs: inout FooStruct) { func testSwitch1() { switch fooObject { - case #^IN_SWITCH_CASE_1^# + case #^IN_SWITCH_CASE_1?check=IN_SWITCH_CASE^# } switch fooObject { - case 1, #^IN_SWITCH_CASE_2^# + case 1, #^IN_SWITCH_CASE_2?check=IN_SWITCH_CASE^# } switch unknown_var { - case #^IN_SWITCH_CASE_3^# + case #^IN_SWITCH_CASE_3?check=IN_SWITCH_CASE^# } switch { - case #^IN_SWITCH_CASE_4^# + case #^IN_SWITCH_CASE_4?check=IN_SWITCH_CASE^# } } @@ -816,12 +612,12 @@ func testInsideFunctionCall10(_ x: inout FooStruct) { // INSIDE_FUNCTION_CALL_10: End completions } func testInsideFunctionCall11(_ x: inout FooStruct) { - x.instanceFunc2(#^INSIDE_FUNCTION_CALL_11^#, + x.instanceFunc2(#^INSIDE_FUNCTION_CALL_11?check=INSIDE_FUNCTION_CALL_4^#, // INSIDE_FUNCTION_CALL_11-NOT: Pattern/{{.*}}:{{.*}}({{.*}}{#Int#} // INSIDE_FUNCTION_CALL_11B: Decl[InstanceMethod]/CurrNominal: ['(']{#Int#}, {#b: &Double#}[')'][#Void#]; } func testInsideFunctionCall12(_ x: inout FooStruct) { - x.instanceFunc2(#^INSIDE_FUNCTION_CALL_12^#<#placeholder#> + x.instanceFunc2(#^INSIDE_FUNCTION_CALL_12?check=INSIDE_FUNCTION_CALL_4^#<#placeholder#> // INSIDE_FUNCTION_CALL_12-NOT: Decl[InstanceMethod]/{{.*}}:{{.*}}({{.*}}{#Int#} } @@ -1027,12 +823,12 @@ func testLookInProto4(_ a: FooProtocol & BarBazProtocolComposition) { //===--- Check that we can resolve function parameters. func testResolveFuncParam1(_ fs: FooStruct) { - fs.#^RESOLVE_FUNC_PARAM_1^# + fs.#^RESOLVE_FUNC_PARAM_1?check=FOO_OBJECT_DOT^# } class TestResolveFuncParam2 { func testResolveFuncParam2a(_ fs: FooStruct) { - fs.#^RESOLVE_FUNC_PARAM_2^# + fs.#^RESOLVE_FUNC_PARAM_2?check=FOO_OBJECT_DOT^# } } @@ -1093,7 +889,7 @@ func testResolveFuncParam6(_ foo: Foo) { class TestResolveConstructorParam1 { init(fs: FooStruct) { - fs.#^RESOLVE_CONSTRUCTOR_PARAM_1^# + fs.#^RESOLVE_CONSTRUCTOR_PARAM_1?check=FOO_OBJECT_DOT^# } } @@ -1198,7 +994,7 @@ func testChainedCalls2() { func testChainedCalls3() { // doBaz() takes a Double. Check that we can recover. - SomeBuilder(42).doFoo().doBaz(SomeBuilder(24))#^CHAINED_CALLS_3^# + SomeBuilder(42).doFoo().doBaz(SomeBuilder(24))#^CHAINED_CALLS_3?xfail=FIXME^# // CHAINED_CALLS_3: Begin completions // CHAINED_CALLS_3-DAG: Decl[InstanceMethod]/CurrNominal: .doFoo()[#SomeBuilder#]{{; name=.+$}} // CHAINED_CALLS_3-DAG: Decl[InstanceMethod]/CurrNominal: .doBar()[#SomeBuilder#]{{; name=.+$}} @@ -1357,9 +1153,7 @@ func testResolveGenericParamsError1() { // FIXME: we could also display correct completion results here, because // swift does not have specialization, and the set of completion results does // not depend on the generic type argument. - FooGenericStruct()#^RESOLVE_GENERIC_PARAMS_ERROR_1^# -// RESOLVE_GENERIC_PARAMS_ERROR_1: found code completion token -// RESOLVE_GENERIC_PARAMS_ERROR_1-NOT: Begin completions + FooGenericStruct()#^RESOLVE_GENERIC_PARAMS_ERROR_1?check=NOCRASH^# } //===--- Check that we can code complete expressions that have unsolved type variables. @@ -1437,7 +1231,7 @@ func testResolveModules1() { //===--- Check that we can complete inside interpolated string literals func testInterpolatedString1() { - "\(fooObject.#^INTERPOLATED_STRING_1^#)" + "\(fooObject.#^INTERPOLATED_STRING_1?check=FOO_OBJECT_DOT1^#)" } // FOO_OBJECT_DOT1: Begin completions @@ -1641,34 +1435,34 @@ protocol Override3: Override2 { } func checkRestatementNoDup1(_ arg: NoDupReq1 & NoDupReq2 & NoDupReq3) { - arg.#^NODUP_RESTATED_REQ1^# - arg#^NODUP_RESTATED_REQ_NODOT1^# + arg.#^NODUP_RESTATED_REQ1?check=CHECK_NODUP_RESTATED_REQ^# + arg#^NODUP_RESTATED_REQ_NODOT1?check=CHECK_NODUP_RESTATED_REQ_NODOT^# } func checkRestatementNoDup2(_ arg: NoDupReq6) { - arg.#^NODUP_RESTATED_REQ2^# + arg.#^NODUP_RESTATED_REQ2?check=CHECK_NODUP_RESTATED_REQ^# } func checkRestatementNoDup3(_ arg: T) { - arg.#^NODUP_RESTATED_REQ3^# - T.#^NODUP_RESTATED_REQ_TYPE1^# - arg#^NODUP_RESTATED_REQ_NODOT2^# + arg.#^NODUP_RESTATED_REQ3?check=CHECK_NODUP_RESTATED_REQ^# + T.#^NODUP_RESTATED_REQ_TYPE1?check=CHECK_NODUP_RESTATED_REQ_TYPE1^# + arg#^NODUP_RESTATED_REQ_NODOT2?check=CHECK_NODUP_RESTATED_REQ_NODOT^# } func checkRestatementNoDup4(_ arg: T) { - arg.#^NODUP_RESTATED_REQ4^# - T.#^NODUP_RESTATED_REQ_TYPE2^# + arg.#^NODUP_RESTATED_REQ4?check=CHECK_NODUP_RESTATED_REQ^# + T.#^NODUP_RESTATED_REQ_TYPE2?check=CHECK_NODUP_RESTATED_REQ_TYPE2^# } func checkRestatementNoDup5(_ arg: T) { - arg.#^NODUP_RESTATED_REQ5^# - T.#^NODUP_RESTATED_REQ_TYPE3^# + arg.#^NODUP_RESTATED_REQ5?check=CHECK_NODUP_RESTATED_REQ^# + T.#^NODUP_RESTATED_REQ_TYPE3?check=CHECK_NODUP_RESTATED_REQ_TYPE3^# } func checkRestatementNoDup6(_ arg: NoDupReq1 & NoDupReq23) { - arg.#^NODUP_RESTATED_REQ6^# - arg#^NODUP_RESTATED_REQ_NODOT3^# + arg.#^NODUP_RESTATED_REQ6?check=CHECK_NODUP_RESTATED_REQ^# + arg#^NODUP_RESTATED_REQ_NODOT3?check=CHECK_NODUP_RESTATED_REQ_NODOT^# } func checkOverrideInclusion1(_ arg: Override) { - arg.#^CHECK_PROT_OVERRIDES1^# + arg.#^CHECK_PROT_OVERRIDES1?check=CHECK_PROT_OVERRIDES^# } func checkOverrideInclusion2(_ arg: Override3) { - arg.#^CHECK_PROT_OVERRIDES2^# + arg.#^CHECK_PROT_OVERRIDES2?check=CHECK_PROT_OVERRIDES^# } // CHECK_NODUP_RESTATED_REQ: Begin completions @@ -1747,23 +1541,23 @@ func testConstrainedP4(_ x: P4) { // PROTOCOL_EXT_P4-NOT: extP4 func testConstrainedConcrete1(_ x: Concrete1) { - x.#^PROTOCOL_EXT_CONCRETE1^# + x.#^PROTOCOL_EXT_CONCRETE1?check=PROTOCOL_EXT_P4_P1^# } func testConstrainedConcrete2(_ x: Generic1) { - x.#^PROTOCOL_EXT_CONCRETE2^# + x.#^PROTOCOL_EXT_CONCRETE2?check=PROTOCOL_EXT_P4_P1^# } func testConstrainedGeneric1(x: Generic1) { - x.#^PROTOCOL_EXT_CONSTRAINED_GENERIC_1^# + x.#^PROTOCOL_EXT_CONSTRAINED_GENERIC_1?check=PROTOCOL_EXT_P4_P1^# } func testConstrainedGeneric2(x: S) { - x.#^PROTOCOL_EXT_CONSTRAINED_GENERIC_2^# + x.#^PROTOCOL_EXT_CONSTRAINED_GENERIC_2?check=PROTOCOL_EXT_P4_P1^# } extension Concrete1 { func testInsideConstrainedConcrete1_1() { - #^PROTOCOL_EXT_INSIDE_CONCRETE1_1^# + #^PROTOCOL_EXT_INSIDE_CONCRETE1_1?check=PROTOCOL_EXT_P4_P1^# } func testInsideConstrainedConcrete1_2() { - self.#^PROTOCOL_EXT_INSIDE_CONCRETE1_2^# + self.#^PROTOCOL_EXT_INSIDE_CONCRETE1_2?check=PROTOCOL_EXT_P4_P1^# } } // PROTOCOL_EXT_P4_P1: Begin completions @@ -1774,26 +1568,26 @@ extension Concrete1 { // PROTOCOL_EXT_P4_P1: End completions func testConstrainedConcrete3(_ x: Concrete2) { - x.#^PROTOCOL_EXT_CONCRETE3^# + x.#^PROTOCOL_EXT_CONCRETE3?check=PROTOCOL_EXT_P4_ONLYME^# } func testConstrainedConcrete3_sub(_ x: Concrete2) { - x#^PROTOCOL_EXT_CONCRETE3_SUB^# + x#^PROTOCOL_EXT_CONCRETE3_SUB?check=PROTOCOL_EXT_P4_ONLYME_SUB^# } func testConstrainedConcrete4(_ x: Generic2) { - x.#^PROTOCOL_EXT_CONCRETE4^# + x.#^PROTOCOL_EXT_CONCRETE4?check=PROTOCOL_EXT_P4_ONLYME^# } func testConstrainedGeneric1(x: S) { - x.#^PROTOCOL_EXT_CONSTRAINED_GENERIC_3^# + x.#^PROTOCOL_EXT_CONSTRAINED_GENERIC_3?check=PROTOCOL_EXT_P4_ONLYME^# } func testConstrainedGeneric1_sub(x: S) { - x#^PROTOCOL_EXT_CONSTRAINED_GENERIC_3_SUB^# + x#^PROTOCOL_EXT_CONSTRAINED_GENERIC_3_SUB?check=PROTOCOL_EXT_P4_ONLYME_SUB^# } extension Concrete2 { func testInsideConstrainedConcrete2_1() { - #^PROTOCOL_EXT_INSIDE_CONCRETE2_1^# + #^PROTOCOL_EXT_INSIDE_CONCRETE2_1?check=PROTOCOL_EXT_P4_ONLYME^# } func testInsideConstrainedConcrete2_2() { - self.#^PROTOCOL_EXT_INSIDE_CONCRETE2_2^# + self.#^PROTOCOL_EXT_INSIDE_CONCRETE2_2?check=PROTOCOL_EXT_P4_ONLYME^# } } // PROTOCOL_EXT_P4_ONLYME: Begin completions @@ -1809,10 +1603,10 @@ extension Concrete2 { // PROTOCOL_EXT_P4_ONLYME_SUB: End completions func testTypealias1() { - Concrete1.#^PROTOCOL_EXT_TA_1^# + Concrete1.#^PROTOCOL_EXT_TA_1?check=PROTOCOL_EXT_TA^# } func testTypealias1() { - S.#^PROTOCOL_EXT_TA_2^# + S.#^PROTOCOL_EXT_TA_2?check=PROTOCOL_EXT_TA^# } // PROTOCOL_EXT_TA: Begin completions // PROTOCOL_EXT_TA_2-DAG: Decl[AssociatedType]/{{Super|CurrNominal}}: T @@ -1844,10 +1638,10 @@ func testProtExtInit2() { extension P4 where Self.T == OnlyMe { final func test1() { - self.#^PROTOCOL_EXT_P4_DOT_1^# + self.#^PROTOCOL_EXT_P4_DOT_1?check=PROTOCOL_EXT_P4_DOT^# } final func test2() { - #^PROTOCOL_EXT_P4_DOT_2^# + #^PROTOCOL_EXT_P4_DOT_2?check=PROTOCOL_EXT_P4_DOT^# } } // PROTOCOL_EXT_P4_DOT: Begin completions @@ -1995,19 +1789,19 @@ func testThrows006() { // AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal{{.*}}: {{.*}}unicodeScalars[#String.UnicodeScalarView#] // AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal{{.*}}: {{.*}}utf16[#String.UTF16View#] func testWithAutoClosure1(_ x: String?) { - (x ?? "autoclosure").#^AUTOCLOSURE1^# + (x ?? "autoclosure").#^AUTOCLOSURE1?check=AUTOCLOSURE_STRING^# } func testWithAutoClosure2(_ x: String?) { - let y = (x ?? "autoclosure").#^AUTOCLOSURE2^# + let y = (x ?? "autoclosure").#^AUTOCLOSURE2?check=AUTOCLOSURE_STRING^# } func testWithAutoClosure3(_ x: String?) { - let y = (x ?? "autoclosure".#^AUTOCLOSURE3^#) + let y = (x ?? "autoclosure".#^AUTOCLOSURE3?check=AUTOCLOSURE_STRING^#) } func testWithAutoClosure4(_ x: String?) { - let y = { let z = (x ?? "autoclosure").#^AUTOCLOSURE4^# } + let y = { let z = (x ?? "autoclosure").#^AUTOCLOSURE4?check=AUTOCLOSURE_STRING^# } } func testWithAutoClosure5(_ x: String?) { - if let y = (x ?? "autoclosure").#^AUTOCLOSURE5^# { + if let y = (x ?? "autoclosure").#^AUTOCLOSURE5?check=AUTOCLOSURE_STRING^# { } } @@ -2131,32 +1925,32 @@ class TestChain { var child: Child! func foo() { - let _ = self.child.value.value.#^COMPLEX_CHAIN_1^# - let _ = child.value.value.#^COMPLEX_CHAIN_2^# -// COMPLEX_CHAIN_1: Begin completions, 3 items -// COMPLEX_CHAIN_1-DAG: Keyword[self]/CurrNominal: self[#Container.Struct2#] -// COMPLEX_CHAIN_1-DAG: Decl[InstanceVar]/CurrNominal: prop1[#Int#] -// COMPLEX_CHAIN_1-DAG: Decl[InstanceVar]/CurrNominal: prop2[#Int#] -// COMPLEX_CHAIN_1: End completions + let _ = self.child.value.value.#^COMPLEX_CHAIN_1?check=COMPLEX_CHAIN^# + let _ = child.value.value.#^COMPLEX_CHAIN_2?check=COMPLEX_CHAIN^# +// COMPLEX_CHAIN: Begin completions, 3 items +// COMPLEX_CHAIN-DAG: Keyword[self]/CurrNominal: self[#Struct2#] +// COMPLEX_CHAIN-DAG: Decl[InstanceVar]/CurrNominal: prop1[#Int#] +// COMPLEX_CHAIN-DAG: Decl[InstanceVar]/CurrNominal: prop2[#Int#] +// COMPLEX_CHAIN: End completions } } // rdar://problem/48453760 struct InitializerTest { let value1: FooStruct = { - $0.#^CLOSURE_IN_MEMBERDECLINIT_1^# + $0.#^CLOSURE_IN_MEMBERDECLINIT_1?check=FOO_OBJECT_DOT^# return $0 }(FooStruct()) let value2: FooStruct = { (b: FooStruct ) -> FooStruct in - b.#^CLOSURE_IN_MEMBERDECLINIT_2^# + b.#^CLOSURE_IN_MEMBERDECLINIT_2?check=FOO_OBJECT_DOT^# return b }(FooStruct()) } // rdar://problem/40944761 extension String { static let v = { (obj: FooStruct) in - obj.#^CLOSURE_IN_MEMBERDECLINIT_3^# + obj.#^CLOSURE_IN_MEMBERDECLINIT_3?check=FOO_OBJECT_DOT^# } } @@ -2169,16 +1963,16 @@ struct SimpleStruct { // SIMPLE_OBJECT_DOT: End completions func testInCollectionLiteral(value: SimpleStruct) { let _ = [ - value.#^IN_ARRAY_LITERAL_1^# + value.#^IN_ARRAY_LITERAL_1?check=SIMPLE_OBJECT_DOT^# ] let _ = [ - value.#^IN_ARRAY_LITERAL_2^#, + value.#^IN_ARRAY_LITERAL_2?check=SIMPLE_OBJECT_DOT^#, ] let _: [String: String] = [ - value.#^IN_DICTIONARY_LITERAL_1^# + value.#^IN_DICTIONARY_LITERAL_1?check=SIMPLE_OBJECT_DOT^# ] let _: [String: String] = [ - value.#^IN_DICTIONARY_LITERAL_2^# : "test" + value.#^IN_DICTIONARY_LITERAL_2?check=SIMPLE_OBJECT_DOT^# : "test" ] } @@ -2206,7 +2000,7 @@ extension BrokenConformanceP { struct BrokenConformanceS: BrokenConformanceP { } func testBrokenConformance(arg: BrokenConformanceS) { - arg.#^BROKEN_CONFORMANCE^# + arg.#^BROKEN_CONFORMANCE?keywords=false^# // BROKEN_CONFORMANCE: Begin completions, 1 items // BROKEN_CONFORMANCE: Decl[InstanceMethod]/Super: instanceFunc()[#Void#]; // BROKEN_CONFORMANCE: End completions @@ -2246,3 +2040,4 @@ func testProtocolMetatype(protoProto: MetaProto.Protocol, protoType: MetaProto.T // PROTOCOLMETA_3-DAG: Decl[InstanceMethod]/CurrNominal: instanceFuncExtension({#(self): MetaProto#})[#() -> Int#]; name=instanceFuncExtension(self: MetaProto) // PROTOCOLMETA_3: End completions } + diff --git a/test/IDE/complete_value_expr_call_pattern_heuristics.swift b/test/IDE/complete_value_expr_call_pattern_heuristics.swift new file mode 100644 index 0000000000000..d0bfb4f50abf3 --- /dev/null +++ b/test/IDE/complete_value_expr_call_pattern_heuristics.swift @@ -0,0 +1,25 @@ +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BEFORE_COMMA -code-complete-call-pattern-heuristics | %FileCheck %s -check-prefix=BEFORE_COMMA +// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BEFORE_PLACEHOLDER -code-complete-call-pattern-heuristics | %FileCheck %s -check-prefix=BEFORE_PLACEHOLDER + +// FIXME: This tests are extracted from complete_value_expr.swift because +// '-batch-code-completion' doesn't support '-code-complete-call-pattern-heuristics' +// Please moved them back to it when it's supported. + +struct FooStruct { + mutating func instanceFunc2(_ a: Int, b: inout Double) {} +} + +func testInsideFunctionCall_1(_ x: inout FooStruct) { + x.instanceFunc(#^BEFORE_COMMA^#, +// BEFORE_COMMA: Begin completions +// BEFORE_COMMA-NOT: Pattern/{{.*}}:{{.*}}({{.*}}{#Int#} +// BOFORE_COMMA-NOT: Decl[InstanceMethod]/{{.*}}:{{.*}}({{.*}}{#Int#} +// BEFORE_COMMA: End completions +} +func testInsideFunctionCall_2(_ x: inout FooStruct) { + x.instanceFunc(#^BEFORE_PLACEHOLDER^#<#placeholder#> +// BEFORE_PLACEHOLDER: Begin completions +// BEFORE_PLACEHOLDER-NOT: Pattern/{{.*}}:{{.*}}({{.*}}{#Int#} +// BOFORE_PLACEHOLDER-NOT: Decl[InstanceMethod]/{{.*}}:{{.*}}({{.*}}{#Int#} +// BEFORE_PLACEHOLDER: End completions +}