-
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 itself
Description
Previous ID | SR-7250 |
Radar | None |
Original Reporter | @hamishknight |
Type | Bug |
Status | Closed |
Resolution | Done |
Environment
Swift version 4.2-dev (LLVM cef3fe6d75, Clang bdc970d89c, Swift 5b60ace)
Target: x86_64-apple-darwin17.4.0
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug |
Assignee | @hamishknight |
Priority | Medium |
md5: f1c1f35674f7cf782c53c23ed4e7f453
Issue Description:
The following doesn't compile:
protocol P {
var i: Int { get }
}
extension P {
var i: Int { return 0 }
}
struct S<T> : P {} // error: Type 'S<T>' does not conform to protocol 'P'
extension S where T : P {
var i: Int { return 0 }
}
However it only doesn't compile while the last extension is constrained to T : P
, if we constrain it to some other protocol (or not at all), the code compiles fine:
// This is fine.
protocol P1 {}
extension S where T : P1 {
var i: Int { return 0 }
}
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 itself