@@ -116,3 +116,33 @@ class C6: C5, ServiceProvider {
116
116
extension ImplementsLoadable : @retroactive Loadable {
117
117
public func loadStuff( withOtherIdentifier otherIdentifier: Int , reply: @escaping ( ) -> Void ) { }
118
118
}
119
+
120
+ class ImplementsDictionaryLoader1 : DictionaryLoader {
121
+ func loadDictionary( completionHandler: @escaping ( [ String : NSNumber ] ? ) -> Void ) { }
122
+ }
123
+
124
+ // expected-error@+1 {{type 'ImplementsDictionaryLoader2' does not conform to protocol 'DictionaryLoader'}}
125
+ class ImplementsDictionaryLoader2 : DictionaryLoader {
126
+ func loadDictionary( completionHandler: @escaping ( [ String : Any ] ? ) -> Void ) { } // expected-note {{candidate has non-matching type '(@escaping ([String : Any]?) -> Void) -> ()'}}
127
+ }
128
+
129
+ // expected-error@+1 {{type 'ImplementsDictionaryLoader3' does not conform to protocol 'DictionaryLoader'}}
130
+ class ImplementsDictionaryLoader3 : DictionaryLoader {
131
+ func loadDictionary( completionHandler: @escaping ( [ String : NSNumber ? ] ? ) -> Void ) { } // expected-note {{candidate has non-matching type '(@escaping ([String : NSNumber?]?) -> Void) -> ()'}}
132
+ }
133
+
134
+ // expected-error@+1 {{type 'ImplementsDictionaryLoader4' does not conform to protocol 'DictionaryLoader'}}
135
+ class ImplementsDictionaryLoader4 : DictionaryLoader {
136
+ func loadDictionary( completionHandler: @escaping ( [ String : Int ] ? ) -> Void ) { } // expected-note {{candidate has non-matching type '(@escaping ([String : Int]?) -> Void) -> ()'}}
137
+ }
138
+
139
+ class ImplementsFloatLoader : FloatLoader {
140
+ public func loadFloat( completionHandler: @escaping ( Float ) -> Void ) { }
141
+ }
142
+
143
+ class ImplementsFloatLoader2 : FloatLoader {
144
+ public func loadFloat( withCompletionHandler completionHandler: @escaping ( Float ) -> Void ) { }
145
+ // expected-warning@-1 {{instance method 'loadFloat(withCompletionHandler:)' nearly matches optional requirement 'loadFloat(completionHandler:)' of protocol 'FloatLoader'}}
146
+ // expected-note@-2 {{rename to 'loadFloat(completionHandler:)' to satisfy this requirement}}
147
+ // expected-note@-3 {{move 'loadFloat(withCompletionHandler:)' to an extension to silence this warning}}
148
+ }
0 commit comments