mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Runtime] Fix crash in protocol conformance checks on KVO artificial subclasses.
tryGetCompleteMetadataNonblocking crashes on artificial subclasses due to the NULL type descriptor. Explicitly check for artificial subclasses in getSuperclassForMaybeIncompleteMetadata and immediately return their Superclass field. Artificial subclasses are always fully initialized so we don't need to do anything special for them. rdar://72583931
This commit is contained in:
@@ -983,6 +983,16 @@ CastsTests.test("Do not overuse __SwiftValue") {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _runtime(_ObjC)
|
||||
CastsTests.test("Artificial subclass protocol conformance") {
|
||||
class SwiftClass: NSObject {}
|
||||
let subclass: AnyClass = objc_allocateClassPair(SwiftClass.self,
|
||||
"ArtificialSwiftSubclass", 0)!
|
||||
objc_registerClassPair(subclass)
|
||||
expectFalse(subclass is P.Type)
|
||||
}
|
||||
#endif
|
||||
|
||||
CastsTests.test("Do not overuse __SwiftValue (non-ObjC)") {
|
||||
struct Bar {}
|
||||
// This should succeed because this is what __SwiftValue boxing is for
|
||||
|
||||
Reference in New Issue
Block a user