Typealias involving `Self` in protocol extension cannot be matched
| Originator: | rix.rob | ||
| Number: | rdar://23063690 | Date Originated: | 11-Oct-2015 03:43 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-beta (7B85) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
I have a protocol extension to which I have added extensions defining much of the behaviour of my system. Several methods use the same dictionary type involving Self for different purposes, so I made a typealias for each different purpose as documentation. This causes typechecking to fail.
Steps to Reproduce:
1. This code:
protocol P {}
extension P {
typealias T = [String:Self]
}
extension P {
func f(t: T) {
g(t)
}
func g(t: T) {}
}
Expected Results:
should typecheck
Actual Results:
but totally doesn’t:
boom.swift:9:5: error: cannot convert value of type '[String : Self]' to expected argument type '[String : _]'
g(t)
^
Regression:
It seems to be fine if `f`’s parameter type is changed from `T` to `[String:Self]`. I.e. it can match `[String:Self]` against the type `T` in `g`’s definition, but it can’t match `T` against `T`.
Notes:
N/A
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!