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
[DiagnosticsQoI] Supe up the NSObject Inheritance Diagnostics
When ObjC interop is enabled, we complain when the user spells a class
that doesn't inherit from NSObject, but still has @objc attached to it.
We should offer a bit more help here. Let's check to see if we can
insert NSObject into their inheritance clause.
rdar://70548656
Copy file name to clipboardExpand all lines: test/Sema/objc_attr_requires_module_1.swift
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@
6
6
// this test cover both cases.
7
7
8
8
@objcclassFoo{} // expected-error {{@objc attribute used without importing module 'Foundation'}} expected-error {{only classes that inherit from NSObject can be declared @objc}} {{1-7=}}
9
+
// expected-note@-1 {{inherit from 'NSObject' to silence this error}} {{16-16=: NSObject}}
Copy file name to clipboardExpand all lines: test/Sema/objc_attr_requires_module_2.swift
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4,3 +4,4 @@ class Foo {}
4
4
_ =Foo()
5
5
6
6
@objcclassNSFoo{} // expected-error {{@objc attribute used without importing module 'Foundation'}} expected-error {{only classes that inherit from NSObject can be declared @objc}} {{1-7=}}
7
+
// expected-note@-1 {{inherit from 'NSObject' to silence this error}} {{18-18=: NSObject}}
0 commit comments