Files
swift-mirror/test/Serialization/Recovery/Inputs/custom-modules/ProtocolInheritance.h
Jordan Rose 4d26358708 [Serialization] Recover from ObjC protocols changing inheritance. (#11109)
When there's an Objective-C protocol that adopts other protocols, the
other protocols become part of the requirement signature. If that can
change, Swift conformances to that protocol will get very confused
when it comes time to deserialize the conformances that satisfy the
requirement signature.

To recover from this, just deserialize /all/ trailing conformances,
rather than follow the requirement signature, and match them up after
the fact. (This only works for Objective-C protocols where we know all
conformance requirements represent inherited protocols, as opposed to
constraints on associated types.)

rdar://problem/33356098
2017-07-24 16:22:10 -07:00

43 lines
985 B
Objective-C

@protocol Order2_ConsistentBaseProto
- (void)consistent;
@end
@protocol Order4_ConsistentBaseProto
- (void)consistent;
@end
@protocol Order1_FickleBaseProto
- (void)fickle;
@optional
- (void)extraFickle;
@end
@protocol Order3_FickleBaseProto
- (void)fickle;
@optional
- (void)extraFickle;
@end
@protocol Order5_FickleBaseProto
- (void)fickle;
@optional
- (void)extraFickle;
@end
// The actual order here is determined by the protocol names.
#if EXTRA_PROTOCOL_FIRST
@protocol SubProto <Order1_FickleBaseProto, Order2_ConsistentBaseProto, Order4_ConsistentBaseProto>
@end
#elif EXTRA_PROTOCOL_MIDDLE
@protocol SubProto <Order2_ConsistentBaseProto, Order3_FickleBaseProto, Order4_ConsistentBaseProto>
@end
#elif EXTRA_PROTOCOL_LAST
@protocol SubProto <Order2_ConsistentBaseProto, Order4_ConsistentBaseProto, Order5_FickleBaseProto>
@end
#elif NO_EXTRA_PROTOCOLS
@protocol SubProto <Order2_ConsistentBaseProto, Order4_ConsistentBaseProto>
@end
#else
# error "Missing -D flag"
#endif