[SR-882] Generic protocol and subclassing breaks type safety and crashes at run time #43494
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
run-time crash
Bug → crash: Swift code crashed during execution
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
Swift 2.2, Swift 3.0
Additional Detail from JIRA
md5: dce6fe503a38874036b1f49c80d7357d
Issue Description:
Implementing a generic protocol
P
in a base classB
and redefining the sametypealias
of the generic protocolP
both in the base classB
and in a subclassS
breaks type safety in combination with a genetic function onP
.Attachment "TypeSafety.swift" is an example of broken type safety where It's possible to assign a
String
to anInt
Attachment "RunTimeCrash.swift" is an example of broken type safety and a run time crash assigning a tuple
(Int, Int)
to aString
Both attachments reproduce the issue in Swift 2.2 and Swift 3.0
The text was updated successfully, but these errors were encountered: