-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Suggest @objc for overrides of declarations from/in extensions. #13417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,30 +61,30 @@ extension E { | |
} | ||
|
||
class C { | ||
static func f1() {} // expected-note 3{{overridden declaration is here}} | ||
static func f1() {} // expected-note 3{{overri}} | ||
class func f2() {} | ||
class func f3() {} | ||
class func f4() {} // expected-note {{overridden declaration is here}} | ||
class func f5() {} // expected-note {{overridden declaration is here}} | ||
class func f4() {} // expected-note {{overri}} | ||
class func f5() {} // expected-note {{overri}} | ||
static final func f6() {} // expected-error {{static declarations are already final}} {{10-16=}} | ||
final class func f7() {} // expected-note 3{{overridden declaration is here}} | ||
final class func f7() {} // expected-note 3{{overri}} | ||
} | ||
|
||
extension C { | ||
static func ef1() {} | ||
class func ef2() {} // expected-note {{overridden declaration is here}} | ||
class func ef3() {} // expected-note {{overridden declaration is here}} | ||
class func ef4() {} // expected-note {{overridden declaration is here}} | ||
class func ef5() {} // expected-note {{overridden declaration is here}} | ||
class func ef2() {} // expected-note {{overri}} | ||
class func ef3() {} // expected-note {{overri}} | ||
class func ef4() {} // expected-note {{overri}} | ||
class func ef5() {} // expected-note {{overri}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or is this a magic string somehow? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the rest of the diagnostic text is ancillary, you can match on a known prefix with the verifier. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a string that's common to both the "we have Objective-C interop" and "we don't have Objective-C interop" cases. If I tried to match the whole thing, the tests would fail on either Linux or Darwin, because the produce different diagnostics depending on whether that particular declaration could be made There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha, smart :) |
||
} | ||
|
||
class C_Derived : C { | ||
override static func f1() {} // expected-error {{cannot override static method}} | ||
override class func f2() {} | ||
class override func f3() {} | ||
|
||
override class func ef2() {} // expected-error {{overriding declarations from extensions is not supported}} | ||
class override func ef3() {} // expected-error {{overriding declarations from extensions is not supported}} | ||
override class func ef2() {} // expected-error {{not supported}} | ||
class override func ef3() {} // expected-error {{not supported}} | ||
override static func f7() {} // expected-error {{static method overrides a 'final' class method}} | ||
} | ||
|
||
|
@@ -98,11 +98,11 @@ class C_Derived3 : C { | |
} | ||
|
||
extension C_Derived { | ||
override class func f4() {} // expected-error {{overriding declarations in extensions is not supported}} | ||
class override func f5() {} // expected-error {{overriding declarations in extensions is not supported}} | ||
override class func f4() {} // expected-error {{not supported}} | ||
class override func f5() {} // expected-error {{not supported}} | ||
|
||
override class func ef4() {} // expected-error {{overriding declarations in extensions is not supported}} | ||
class override func ef5() {} // expected-error {{overriding declarations in extensions is not supported}} | ||
override class func ef4() {} // expected-error {{not supported}} | ||
class override func ef5() {} // expected-error {{not supported}} | ||
} | ||
|
||
protocol P { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a typo?