mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Deserializing a witness record in a conformance may fail if either of the requirement or witness changed name or type, most likely due to SDK modernization changes across Swift versions. When this happens, leave an opaque placeholder in the conformance to indicate that the witness exists but we don't get to see it. For expedience, right now this just witnesses the requirement to itself, so that code in the type checker or elsewhere that tries to ad-hoc devirtualize references to the requirement just gets the requirement back. Arguably, we shouldn't include the witness at all in imported conformances, since they should be an implementation detail, but that's a bigger, riskier change. This patch as is should be enough to address rdar://problem/31185053.
25 lines
912 B
Objective-C
25 lines
912 B
Objective-C
// Swift 3 sees the ObjC class NSRuncibleSpoon as the class, and uses methods
|
|
// with type signatures involving NSRuncibleSpoon to conform to protocols
|
|
// across the language boundary. Swift 4 sees the type as bridged to
|
|
// a RuncibleSpoon value type, but still needs to be able to use conformances
|
|
// declared by Swift 3.
|
|
|
|
@import Foundation;
|
|
|
|
@interface NSRuncibleSpoon: NSObject
|
|
@end
|
|
|
|
@interface SomeObjCClass: NSObject
|
|
- (instancetype _Nonnull)initWithSomeSwiftInitRequirement:(NSRuncibleSpoon* _Nonnull)s;
|
|
- (void)someSwiftMethodRequirement:(NSRuncibleSpoon* _Nonnull)s;
|
|
@property NSRuncibleSpoon * _Nonnull someSwiftPropertyRequirement;
|
|
@end
|
|
|
|
@protocol SomeObjCProtocol
|
|
- (instancetype _Nonnull)initWithSomeObjCInitRequirement:(NSRuncibleSpoon * _Nonnull)string;
|
|
- (void)someObjCMethodRequirement:(NSRuncibleSpoon * _Nonnull)string;
|
|
@property NSRuncibleSpoon * _Nonnull someObjCPropertyRequirement;
|
|
@end
|
|
|
|
|