Commit Graph

8 Commits

Author SHA1 Message Date
Slava Pestov
8ecb83e29a Sema: Diagnose unsupported '@objc' on classes and members of extensions of classes with resilient ancestry
Unless -enable-resilient-objc-class-stubs is passed in, these cases
are not supported, so now we diagnose them instead of asserting or
failing to link.

Note the behavior change here; classes with resilient ancestry were
previously isObjC(). However this is wrong since isObjC() means
"statically visible to Objective-C via the generated header".

After this patch, isObjC() only returns true for a class with resilient
ancestry if -enable-resilient-objc-class-stubs is passed in.
2019-03-26 18:58:12 -04:00
Slava Pestov
4069fa68db Sema: Lift restriction on @objc categories of concrete subclasses of generic classes
In-place initialization means the class has a symbol we can reference
from the category, so there's nothing to do on the IRGen side.

For JIT mode, we just need to realize the class metadata by calling an
accessor instead of directly referencing the symbol though.
2018-08-20 16:23:07 -07:00
Mark Lacey
78d83e5703 Use %target-typecheck-verify-swift where possible. 2018-07-26 23:13:43 -07:00
Huon Wilson
d33a5c16f2 [Sema] Explicit error for "extension GenericClass : ObjcProtocol".
If there was any requirements in the @objc protocol, the user got an error in
some form (a complaint about those requirements), but giving the direct error is
better, and handles @objc protocol with no requirements.

Also, fix a hole in that existing @objc method check: in `class Outer<T> { class
Inner {} }`, Inner should be considered generic, but the loop that was checking
for this didn't consider it.

Fixes https://bugs.swift.org/browse/SR-7370 and rdar://problem/39239512.
2018-04-13 08:09:02 +10:00
TheOtherDave
7eee82a9b3 Add files via upload 2017-03-15 20:58:11 -07:00
TheOtherDave
505801d946 fixed expected error message 2017-03-15 18:30:00 -07:00
TheOtherDave
1a2703307e Add files via upload
"@objc is not supported within extensions of generic classes, or classes that inherit from generic classes"
2017-03-15 17:54:32 -07:00
TheOtherDave
03257c36ab Tests for error: objc_in_generic_extension
"@objc is not supported within extensions of generic classes, or classes that inherit from generic classes"
2017-03-15 17:25:40 -07:00