[SR-10547] Unavailable class with Swift-only protocol implementation causes a crash in getCanonicalTypeMetadata #52947
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
crash
Bug: A crash, i.e., an abnormal termination of software
regression
run-time crash
Bug → crash: Swift code crashed during execution
swift 5.0
Attachment: Download
Additional Detail from JIRA
md5: 7cca5f7cab0ff32756235f128b90b95f
Issue Description:
When a class that is only available starting with a given version of iOS implements a Swift only protocol, a crash occurs when testing conformance to this protocol on previous versions of iOS.
The following example crashes on all versions of iOS below iOS 12.0 :
The
UITextInputPasswordRules
is just an example of a class that was introduced in iOS 12, any other class introduced in iOS 12 will cause the same crash.iOS 12 is just an example of a version of iOS. If the class is only available in iOS n, then the crash occurs on all versions of iOS less than n.
This bug was introduced in Xcode 10.2 and does not seem to occur in Xcode 10.1
Compiled with Xcode 10.2, Swift 5.0 -> Crash
Compiled with Xcode 10.2, Swift 4.2 -> Crash
Compiled with Xcode 10.1, Swift 4.2 -> No crash
Workaround: If the protocol
TestProtocol
is declared@objc
, no crash occurs.Stacktrace :
Console logs :
The text was updated successfully, but these errors were encountered: