Skip to content

Commit 80dbf7e

Browse files
committed
rdar://problem/47871647
1 parent 6da2ca7 commit 80dbf7e

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

test/IDE/complete_override_typealias.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ protocol MyProtocol {
88
associatedtype Result
99
typealias Arg1 = Generic<Self>
1010
typealias Arg2<X> = Generic<X>
11+
typealias Func = () -> Int
1112
func foo<U>(arg1: Arg1, arg2: Arg2<U>, arg3: Arg2<Int>, arg4: [Arg1], arg5: Arg2<U>? arg6: Generic<Arg2<Generic<Arg2<Int>>>>) -> Result
1213
func bar() -> Result
14+
func baz(arg: @escaping Func)
1315
}
1416

1517
struct MyStruct1 : MyProtocol {
@@ -29,17 +31,20 @@ struct MyStruct3 : MyProtocol {
2931
func #^OVERRIDE_3^#
3032
}
3133

32-
// OVERRIDE_1: Begin completions, 2 items
34+
// OVERRIDE_1: Begin completions, 3 items
3335
// OVERRIDE_1-DAG: Decl[InstanceMethod]/Super: foo<U>(arg1: Arg1, arg2: Arg2<U>, arg3: Arg2<Int>, arg4: [Arg1], arg5: Arg2<U>?, arg6: Generic<Arg2<Generic<Arg2<Int>>>>) -> Result {|};
3436
// OVERRIDE_1-DAG: Decl[InstanceMethod]/Super: bar() -> Result {|};
37+
// OVERRIDE_1-DAG: Decl[InstanceMethod]/Super: baz(arg: @escaping Func) {|};
3538
// OVERRIDE_1: End completions
3639

37-
// OVERRIDE_2: Begin completions, 2 items
40+
// OVERRIDE_2: Begin completions, 3 items
3841
// OVERRIDE_2-DAG: Decl[InstanceMethod]/Super: foo<U>(arg1: Arg1, arg2: Arg2<U>, arg3: Arg2<Int>, arg4: [Arg1], arg5: Arg2<U>?, arg6: Generic<Arg2<Generic<Arg2<Int>>>>) -> String {|};
3942
// OVERRIDE_2-DAG: Decl[InstanceMethod]/Super: bar() -> String {|};
43+
// OVERRIDE_2-DAG: Decl[InstanceMethod]/Super: baz(arg: @escaping Func) {|};
4044
// OVERRIDE_2: End completions
4145

42-
// OVERRIDE_3-DAG: Begin completions, 1 items
46+
// OVERRIDE_3-DAG: Begin completions, 2 items
4347
// OVERRIDE_3-DAG: Decl[InstanceMethod]/Super: foo<U>(arg1: Arg1, arg2: Arg2<U>, arg3: Arg2<Int>, arg4: [Arg1], arg5: Arg2<U>?, arg6: Generic<Arg2<Generic<Arg2<Int>>>>) -> String {|};
48+
// OVERRIDE_3-DAG: Decl[InstanceMethod]/Super: baz(arg: @escaping Func) {|};
4449
// OVERRIDE_3-DAG: End completions
4550

test/decl/protocol/conforms/fixit_stub_editor.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,12 @@ struct Struct3: PropertyMutabilityProto { // expected-error{{type 'Struct3' does
7272
class Class4 {}
7373
extension Class4: PropertyMutabilityProto { // expected-error{{type 'Class4' does not conform to protocol 'PropertyMutabilityProto'}} expected-note{{do you want to add protocol stubs?}} {{44-44=\n var computed: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n var stored: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
7474
}
75+
76+
// https://bugs.swift.org/browse/SR-9868
77+
protocol FooProto {
78+
typealias CompletionType = (Int) -> Void
79+
func doSomething(then completion: @escaping CompletionType)
80+
}
81+
82+
struct FooType : FooProto { // expected-error {{type 'FooType' does not conform to protocol 'FooProto'}} expected-note {{do you want to add protocol stubs?}} {{28-28=\n func doSomething(then completion: @escaping CompletionType) {\n <#code#>\n \}\n}}
83+
}

0 commit comments

Comments
 (0)