swift
swift copied to clipboard
[SR-2158] Unhelpful diagnostic regarding same-type constraint
| Previous ID | SR-2158 |
| Radar | rdar://problem/27515839 |
| Original Reporter | @rudkx |
| Type | Bug |
| Status | Closed |
| Resolution | Done |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, TypeChecker |
| Assignee | @rudkx |
| Priority | Medium |
md5: 5cf843daed714971263e9ea9b82db396
Issue Description:
Compiling the following results in:
<unknown>:0: error: same-type constraint type 'τ_0_0' does not conform to required protocol 'PC'
This is not a very helpful, or very actionable, diagnostic.
public protocol PS {}
public protocol PC {}
public protocol PIB {
associatedtype I : PC
}
public protocol PI : PIB {}
public struct CR<B> where B : PS & PC {}
public struct R<B : PC> {}
extension R where B : PS {
init(_ o: CR<B>) {}
}
public struct S : PC {}
public protocol PRE {
associatedtype B : PC
func r<C: PI>(to c: C) -> R<B> where C.I == B
}
extension CR: PRE {
public func r<C: PI>(to c: C) -> R<B> where C.I == B {
return R(self)
}
}
Fixed at some point along the way.