You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[FixCode] Add @escaping when overriding mismatch is because of it. (#4273)
* [FixCode] Add @escaping when overriding mismatch is because of it. rdar://27814862
With the change of default escaping behavior, users' existing code overriding
objc functions may need to add @escaping to make the overriding match as before. This
patch checks if an overriding mismatch is due to the lacking of @escaping and add
it as a fixit.
* [test] Update existing test. NFC
overridefunc foo1(a :Int, b :()->()){} // expected-error {{method does not override any method from its superclass}} expected-note {{type does not match superclass instance method with type '(Int, @escaping () -> ()) -> ()'}} {{34-34=@escaping }}
23
+
overridefunc foo2(a :(Int)->(Int), b :()->()){} // expected-error {{method does not override any method from its superclass}} expected-note{{type does not match superclass instance method with type '(@escaping (Int) -> (Int), @escaping () -> ()) -> ()'}} {{25-25=@escaping }} {{43-43=@escaping }}
// expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{26-47=@autoclosure @escaping }}
91
-
overridefunc f2(_ x:@autoclosure()->()){} // expected-error{{does not override any method}}
91
+
overridefunc f2(_ x:@autoclosure()->()){} // expected-error{{does not override any method}} // expected-note{{type does not match superclass instance method with type '(@autoclosure @escaping () -> ()) -> ()'}}
92
92
overridefunc f3(_ x:@autoclosure(escaping)()->()){} // expected-error{{does not override any method}}
93
93
// expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{26-47=@autoclosure @escaping }}
0 commit comments