Open
Description
Previous ID | SR-2235 |
Radar | None |
Original Reporter | ndis1 (JIRA User) |
Type | Bug |
Environment
swift 2.2, swift 3 with xcode 8.0 beta 3 8S174q
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 739eee6d1c31d6ff47387fe89b0a87a5
Issue Description:
When a child protocol redeclares an associatedtype from its parent and adds a new constraint, type inference for that associatedtype breaks. This code reproduces the bug in a playground on swift 2.2 and the swift 3 that ships with xcode 8.0 beta 3 8S174q.
protocol Parent {
associatedtype T: UIView
func f() -> T
}
protocol Child: Parent {
associatedtype T: UITableViewCell
}
struct S: Child {
//typealias T = UITableViewCell//required - inference not working - without this typealias, the compiler shows an error 'Parent' requires that 'T' (aka <<error type>>)inherit from UIView
func f() -> UITableViewCell {
return UITableViewCell()
}
}