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
[Sema] FixIt for override func that should be override var and vice-versa
Resolves#57499
This adds `override_property_not_method` and `override_method_not_property` notes by performing
a member lookup for the respective diagnostics.
Copy file name to clipboardExpand all lines: test/decl/inherit/override.swift
+17
Original file line number
Diff line number
Diff line change
@@ -86,3 +86,20 @@ class ObjCSub : ObjCSuper {
86
86
87
87
@objc(method3:withInt:)func method3(_ x:Sub, with y:Int){} // expected-error{{method3(_:with:)' with Objective-C selector 'method3:withInt:' conflicts with method 'method3(_:withInt:)' from superclass 'ObjCSuper' with the same Objective-C selector}}
88
88
}
89
+
90
+
classC{
91
+
varv1:Bool{
92
+
returnfalse
93
+
}
94
+
95
+
func f1()->Int{}
96
+
}
97
+
98
+
classD:C{
99
+
overridefunc v1()->Bool{} // expected-error{{method does not override any method from its superclass}}
100
+
// expected-note@-1{{did you mean to override the property 'v1'}} {{12-16=var}} {{19-29=: Bool}}
101
+
102
+
overridevarf1:Int{ // expected-error{{property does not override any property from its superclass}}
103
+
return0 // expected-note@-1{{did you mean to override the method 'f1'}} {{12-15=func}}
0 commit comments