Open
Description
Previous ID | SR-11417 |
Radar | rdar://problem/55114221 |
Original Reporter | @jeremyabannister |
Type | Bug |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, AssociatedTypeInference |
Assignee | None |
Priority | Medium |
md5: 001072ec536c5ffe7ab2fefe44ba1db9
Issue Description:
This code fails to compile with swift 5:
protocol A {
associatedtype Value
}
protocol B: A {
func f (x: Any?) -> Value?
}
struct C: B {
func f (x: Any?) -> String? {
return nil
}
}
The error is:
Type 'C' does not conform to protocol 'A'
Simply adding this:
typealias Value = String
to C fixes error. I was very surprised about this, as this seems like quite a basic type inference situation. Am I missing something or is this simply a bug?