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
Objective-C has some classes that don't support the ObjC weak-reference machinery, and therefore Clang warns about making a __weak reference to such a class. Swift's weak and unowned references depend on that same machinery for ObjC classes, so we should have a similar diagnostic; I think ours should just be a hard error, though.
Note that attributes like IBOutlet imply making a weak reference, and we should make sure the diagnostic catches them as well. Or maybe we should just make the outlet implicitly unowned(unsafe)?
The code from the Clang compiler that performs this check is as follows; this bug is mostly a matter of doing a similar check when checking a weak/unowned reference in Swift.
if (lifetime == Qualifiers::OCL_Weak) {
if (const ObjCObjectPointerType *ObjT =
type->getAs<ObjCObjectPointerType>()) {
if (ObjCInterfaceDecl *Class = ObjT->getInterfaceDecl()) {
if (Class->isArcWeakrefUnavailable()) {
S.Diag(AttrLoc, diag::err_arc_unsupported_weak_class);
S.Diag(ObjT->getInterfaceDecl()->getLocation(),
diag::note_class_declared);
}
}
}
}
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: c8c885eba41db6083c685ccae0478cf5
Issue Description:
Objective-C has some classes that don't support the ObjC weak-reference machinery, and therefore Clang warns about making a __weak reference to such a class. Swift's weak and unowned references depend on that same machinery for ObjC classes, so we should have a similar diagnostic; I think ours should just be a hard error, though.
Note that attributes like IBOutlet imply making a weak reference, and we should make sure the diagnostic catches them as well. Or maybe we should just make the outlet implicitly unowned(unsafe)?
The code from the Clang compiler that performs this check is as follows; this bug is mostly a matter of doing a similar check when checking a weak/unowned reference in Swift.
The text was updated successfully, but these errors were encountered: