mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IDE] Adjust test cases for migrating all completion kinds to solver-based
This commit is contained in:
@@ -395,8 +395,12 @@ CreateThings {
|
||||
CreateThings {
|
||||
Thing { point in
|
||||
print("hello")
|
||||
point. // ErrorExpr
|
||||
point.#^MULTICLOSURE_FUNCBUILDER_ERROR?check=POINT_MEMBER^#
|
||||
do {
|
||||
point. // ErrorExpr
|
||||
}
|
||||
do {
|
||||
point.#^MULTICLOSURE_FUNCBUILDER_ERROR?check=POINT_MEMBER^#
|
||||
}
|
||||
}
|
||||
Thing { point in
|
||||
print("hello")
|
||||
|
||||
@@ -686,7 +686,7 @@ extension MyType where T == Int {
|
||||
func testTypecheckedTypeExpr() {
|
||||
MyType(#^TYPECHECKED_TYPEEXPR^#
|
||||
}
|
||||
// TYPECHECKED_TYPEEXPR: Decl[Constructor]/CurrNominal/Flair[ArgLabels]: ['(']{#arg1: String#}, {#arg2: _#}[')'][#MyType<_>#]; name=arg1:arg2:
|
||||
// TYPECHECKED_TYPEEXPR: Decl[Constructor]/CurrNominal/Flair[ArgLabels]: ['(']{#arg1: String#}, {#arg2: T#}[')'][#MyType<T>#]; name=arg1:arg2:
|
||||
// TYPECHECKED_TYPEEXPR: Decl[Constructor]/CurrNominal/Flair[ArgLabels]: ['(']{#(intVal): Int#}[')'][#MyType<Int>#]; name=:
|
||||
|
||||
func testPamrameterFlags(_: Int, inoutArg: inout Int, autoclosureArg: @autoclosure () -> Int, iuoArg: Int!, variadicArg: Int...) {
|
||||
@@ -1370,3 +1370,23 @@ func testParameterPack(intArray: [Int]) {
|
||||
// PARAMETER_PACK_ARG: Pattern/Local/Flair[ArgLabels]: {#otherParam: Int#}[#Int#]; name=otherParam:
|
||||
// PARAMETER_PACK_ARG: Decl[LocalVar]/Local/TypeRelation[Convertible]: intArray[#[Int]#]; name=intArray
|
||||
}
|
||||
|
||||
struct AmbiguousCallInResultBuilder {
|
||||
@resultBuilder
|
||||
struct MyResultBuilder {
|
||||
static func buildBlock(_ value: Int) -> Int {
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
func ttroke(_ content: Int, style: String) -> Int { 41 }
|
||||
func ttroke(_ content: Int, lineWidth: Int = 1) -> Int { 42 }
|
||||
|
||||
@MyResultBuilder var body: Int {
|
||||
self.ttroke(1, #^AMBIGUOUS_IN_RESULT_BUILDER?xfail=TODO^#)
|
||||
// AMBIGUOUS_IN_RESULT_BUILDER: Begin completions, 2 items
|
||||
// AMBIGUOUS_IN_RESULT_BUILDER-DAG: Pattern/Local/Flair[ArgLabels]: {#style: String#}[#String#];
|
||||
// AMBIGUOUS_IN_RESULT_BUILDER-DAG: Pattern/Local/Flair[ArgLabels]: {#lineWidth: Int#}[#Int#];
|
||||
// AMBIGUOUS_IN_RESULT_BUILDER: End completions
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t -code-complete-call-pattern-heuristics
|
||||
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t -code-complete-call-pattern-heuristics -disable-objc-attr-requires-foundation-module
|
||||
|
||||
struct FooStruct {
|
||||
init() {}
|
||||
@@ -33,6 +33,23 @@ func testArg2Name3() {
|
||||
// LABELED_FIRSTARG-NOT: ['(']{#arg1: Int#}, {#arg2: Int#}[')'][#Void#];
|
||||
// LABELED_FIRSTARG-DAG: Pattern/Local/Flair[ArgLabels]: {#arg1: Int#}[#Int#];
|
||||
// LABELED_FIRSTARG-NOT: ['(']{#arg1: Int#}, {#arg2: Int#}[')'][#Void#];
|
||||
}
|
||||
|
||||
func optionalClosure(optClosure: ((Int) -> Void)?, someArg: Int) {
|
||||
optClosure?(#^OPTIONAL_CLOSURE^#someArg)
|
||||
// OPTIONAL_CLOSURE-DAG: Decl[LocalVar]/Local/TypeRelation[Convertible]: someArg[#Int#]; name=someArg
|
||||
}
|
||||
|
||||
func optionalProtocolMethod() {
|
||||
@objc protocol Foo {
|
||||
@objc optional func foo(arg: Int)
|
||||
}
|
||||
|
||||
func test(foo: Foo) {
|
||||
foo.foo?(#^OPTIONAL_PROTOCOL_METHOD^#)
|
||||
// OPTIONAL_PROTOCOL_METHOD-DAG: Decl[InstanceMethod]/CurrNominal/Flair[ArgLabels]: ['(']{#arg: Int#}[')'][#Void#];
|
||||
}
|
||||
}
|
||||
|
||||
func subscriptAccess(info: [String: Int]) {
|
||||
info[#^SUBSCRIPT_ACCESS^#]
|
||||
@@ -49,3 +66,30 @@ struct StaticMethods {
|
||||
// AFTER_STATIC_FUNC-DAG: Pattern/CurrModule/Flair[ArgLabels]: ()[#Int#];
|
||||
// AFTER_STATIC_FUNC: End completions
|
||||
}
|
||||
|
||||
struct AmbiguousInResultBuilder {
|
||||
@resultBuilder
|
||||
struct MyViewBuilder {
|
||||
static func buildBlock(_ elt: Text) -> Int {
|
||||
53
|
||||
}
|
||||
}
|
||||
|
||||
struct Text {
|
||||
init(verbatim content: String) {}
|
||||
init<S>(_ content: S) where S : StringProtocol {}
|
||||
}
|
||||
|
||||
func foo(@MyViewBuilder content: () -> Int) {}
|
||||
|
||||
func test(myStr: String) {
|
||||
foo {
|
||||
Text(#^AMBIGUOUS_IN_RESULT_BUILDER?xfail=TODO^#)
|
||||
// AMBIGUOUS_IN_RESULT_BUILDER: Begin completions
|
||||
// AMBIGUOUS_IN_RESULT_BUILDER-DAG: Decl[Constructor]/CurrNominal/Flair[ArgLabels]: ['(']{#verbatim: String#}[')'][#Text#]; name=verbatim:
|
||||
// AMBIGUOUS_IN_RESULT_BUILDER-DAG: Decl[Constructor]/CurrNominal/Flair[ArgLabels]: ['(']{#(content): _#}[')'][#Text#]; name=:
|
||||
// AMBIGUOUS_IN_RESULT_BUILDER-DAG: Decl[LocalVar]/Local/TypeRelation[Convertible]: myStr[#String#]; name=myStr
|
||||
// AMBIGUOUS_IN_RESULT_BUILDER: End completions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ func testUnqualified1(x: QuxEnum) {
|
||||
_ = (x == .Qux1#^UNRESOLVED_3^#)
|
||||
// UNRESOLVED_3-DAG: Decl[InstanceVar]/CurrNominal: .rawValue[#Int#]; name=rawValue
|
||||
// UNRESOLVED_3-DAG: Decl[InstanceVar]/Super/IsSystem: .hashValue[#Int#]; name=hashValue
|
||||
// UNRESOLVED_3-DAG: Decl[InstanceMethod]/Super/IsSystem: .hash({#into: &Hasher#})[#Void#]; name=hash(into:)
|
||||
// UNRESOLVED_3-DAG: Decl[InstanceMethod]/Super/IsSystem/TypeRelation[Invalid]: .hash({#into: &Hasher#})[#Void#]; name=hash(into:)
|
||||
// UNRESOLVED_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: ~= {#QuxEnum#}[#Bool#]; name=~=
|
||||
// UNRESOLVED_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: != {#QuxEnum#}[#Bool#]; name=!=
|
||||
// UNRESOLVED_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: == {#QuxEnum#}[#Bool#]; name===
|
||||
|
||||
@@ -59,7 +59,7 @@ func testGlobalLookup() {
|
||||
|
||||
@TupleBuilder<String> var x5 {
|
||||
"hello: \(#^GLOBAL_LOOKUP_IN_STRING_LITERAL^#)"
|
||||
// GLOBAL_LOOKUP_IN_STRING_LITERAL: Decl[GlobalVar]/CurrModule/TypeRelation[Convertible]: MyConstantString[#String#];
|
||||
// GLOBAL_LOOKUP_IN_STRING_LITERAL: Decl[GlobalVar]/CurrModule: MyConstantString[#String#];
|
||||
}
|
||||
|
||||
@TupleBuilder<String> var x5 {
|
||||
@@ -87,7 +87,7 @@ func testStaticMemberLookup() {
|
||||
@TupleBuilder<String> var x3 {
|
||||
"hello: \(StringFactory.#^COMPLETE_STATIC_MEMBER_IN_STRING_LITERAL^#)"
|
||||
// COMPLETE_STATIC_MEMBER_IN_STRING_LITERAL: Begin completions
|
||||
// COMPLETE_STATIC_MEMBER_IN_STRING_LITERAL: Decl[StaticMethod]/CurrNominal/TypeRelation[Convertible]: makeString({#x: String#})[#String#];
|
||||
// COMPLETE_STATIC_MEMBER_IN_STRING_LITERAL: Decl[StaticMethod]/CurrNominal: makeString({#x: String#})[#String#];
|
||||
// COMPLETE_STATIC_MEMBER_IN_STRING_LITERAL: End completions
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ public enum Endpoint {
|
||||
}
|
||||
}
|
||||
}
|
||||
// CHECK: Decl[LocalVar]/Local/TypeRelation[Convertible]: myInt[#Int#];
|
||||
// CHECK: Decl[LocalVar]/Local: myInt[#Int#];
|
||||
|
||||
@@ -71,13 +71,12 @@ func testArray(f1: Float) {
|
||||
_ = [1, 2, f1] #^LITERAL8^#
|
||||
}
|
||||
// LITERAL8-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .count[#Int#]; name=count
|
||||
// LITERAL8-DAG: Decl[InstanceVar]/Super/IsSystem: .first[#Float?#]; name=first
|
||||
// LITERAL8-DAG: Decl[InstanceVar]/Super/IsSystem: .first[#Any?#]; name=first
|
||||
|
||||
func testDict(f1: Float) {
|
||||
_ = ["foo": f1, "bar": "baz"] #^LITERAL9^#
|
||||
}
|
||||
// LITERAL9-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .keys[#Dictionary<String, String>.Keys#]; name=keys
|
||||
// LITERAL9-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .keys[#Dictionary<String, Float>.Keys#]; name=keys
|
||||
// LITERAL9-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .keys[#Dictionary<String, Any>.Keys#]; name=keys
|
||||
// LITERAL9-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .isEmpty[#Bool#]; name=isEmpty
|
||||
|
||||
func testEditorPlaceHolder() {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// RUN: %target-swift-ide-test -repl-code-completion -source-filename %s | %FileCheck %s
|
||||
|
||||
// CHECK-DAG: .self: _
|
||||
// CHECK-DAG: {{^}}true: Bool{{$}}
|
||||
|
||||
tru
|
||||
|
||||
@@ -4,7 +4,7 @@ func takeClosure(x: () -> Void) {}
|
||||
func takeString(_ a: String) -> MyStruct {}
|
||||
|
||||
struct MyStruct {
|
||||
func style() {}
|
||||
func style(arg: Int) {}
|
||||
}
|
||||
|
||||
func foo() {
|
||||
@@ -13,3 +13,8 @@ func foo() {
|
||||
.style(#^COMPLETE^#)
|
||||
}
|
||||
}
|
||||
|
||||
// COMPLETE: Begin completions, 1 items
|
||||
// COMPLETE: Decl[InstanceMethod]/CurrNominal/Flair[ArgLabels]/TypeRelation[Convertible]: ['(']{#arg: Int#}[')'][#Void#];
|
||||
// COMPLETE: End completions
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@ func test010(x: E1, y: FooBar) {
|
||||
// INNER_POSTFIX_0b-NOT: key.description: "one{{.+}}"
|
||||
// INNER_POSTFIX_0b: key.description: "one",{{$}}
|
||||
// INNER_POSTFIX_0b: key.description: "one.",{{$}}
|
||||
// INNER_POSTFIX_0b: key.description: "one==",{{$}}
|
||||
// INNER_POSTFIX_0b: key.description: "one!=",{{$}}
|
||||
// INNER_POSTFIX_0b: key.description: "one~=",{{$}}
|
||||
// INNER_POSTFIX_0b-NOT: key.description: "one{{.+}}"
|
||||
|
||||
// RUN: %sourcekitd-test -req=complete.open -pos=27:9 -req-opts=filtertext=pro %s -- %s | %FileCheck %s -check-prefix=INNER_POSTFIX_1
|
||||
|
||||
@@ -236,7 +236,7 @@ func test8() {
|
||||
}
|
||||
// CALLARG: (arg: String)
|
||||
// CALLARG: (label: Int)
|
||||
// CALLARG: intVal
|
||||
// CALLARG: stringVal
|
||||
// CALLARG: String
|
||||
// CALLARG: intVal
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Make sure we don't crash
|
||||
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token COMPLETE
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t
|
||||
|
||||
public struct AnyError {
|
||||
|
||||
@@ -10,3 +10,8 @@ extension AnyError {
|
||||
return AnyError(error)#^COMPLETE^#
|
||||
}
|
||||
}
|
||||
|
||||
// COMPLETE: Begin completions, 1 items
|
||||
// COMPLETE: Keyword[self]/CurrNominal: .self[#AnyError#];
|
||||
// COMPLETE: End completions
|
||||
|
||||
|
||||
@@ -71,5 +71,5 @@ struct SplitView: View2 {
|
||||
}
|
||||
}
|
||||
|
||||
// COMPLETE-DAG: Decl[InstanceMethod]/Super/TypeRelation[Convertible]: frame()[#Never#]; name=frame()
|
||||
// COMPLETE-DAG: Decl[InstanceMethod]/Super/TypeRelation[Convertible]: frame({#width: Int?#}, {#height: Int?#})[#Never#]; name=frame(width:height:)
|
||||
// COMPLETE-DAG: Decl[InstanceMethod]/Super: frame()[#Never#]; name=frame()
|
||||
// COMPLETE-DAG: Decl[InstanceMethod]/Super: frame({#width: Int?#}, {#height: Int?#})[#Never#]; name=frame(width:height:)
|
||||
|
||||
Reference in New Issue
Block a user