Open
Description
Previous ID | SR-11194 |
Radar | rdar://problem/53500178 |
Original Reporter | @keith |
Type | Bug |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, 5.1Regression, SourceCompatibility |
Assignee | None |
Priority | Medium |
md5: a6e9a93cd915d1ca07e927f7735fb20e
Issue Description:
With this code:
protocol P1 {
var foo: Foo! { get }
}
protocol P2: AnyObject {
var foo: Foo! { get set }
}
struct Foo {
func doSomething() {}
}
protocol P3 {}
extension P3 where Self: P1 & P2 {
func bar() {
self.foo?.doSomething()
}
}
It compiles fine with Swift 5.0 / Xcode 10.2.1, but with Swift 5.1 / Xcode 11b4 you get this error:
bar.swift:17:9: error: ambiguous use of 'foo'
self.foo?.doSomething()
^
bar.swift:6:9: note: found this candidate
var foo: Foo! { get set }
^
bar.swift:2:9: note: found this candidate
var foo: Foo! { get set }
^
If you replace the callsite with:
let foo: Foo? = self.foo
foo?.doSomething()
It works