-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfoptimized onlyFlag: An issue whose reproduction requires optimized compilationFlag: An issue whose reproduction requires optimized compilation
Description
| Previous ID | SR-1158 |
| Radar | None |
| Original Reporter | diegosanchezr (JIRA User) |
| Type | Bug |
| Status | Closed |
| Resolution | Done |
Attachment: Download
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, OptimizedOnly |
| Assignee | @jckarter |
| Priority | Medium |
md5: 88d26548a43585e6ea0dfa127129503d
Issue Description:
Module 1:
public protocol MyProtocol {}
public class ClassLevel1: MyProtocol {
public init() {}
}
public class ClassLevel2: ClassLevel1 {
public override init () {}
}Modue 2:
class ClassLevel3: ClassLevel2 {
override init() {
super.init()
}
}
func createClassLevel3() -> MyProtocol {
let class3 = ClassLevel3()
return class3 // <- Compiler error. Says doesn't conform to MyProtocol
}Workaround:
func createClassLevel3() -> MyProtocol {
let class3 = ClassLevel3()
return class3 as! MyProtocol
}Only happens with whole-module-optimization. Affected versions: swift-2.2, swift-2.2.1-SNAPSHOT-2016-03-28-a.
Doesn't affect swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfoptimized onlyFlag: An issue whose reproduction requires optimized compilationFlag: An issue whose reproduction requires optimized compilation