Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-11194] Ambiguous use of protocol member with 5.1 #53591

Open
keith opened this issue Jul 24, 2019 · 2 comments
Open

[SR-11194] Ambiguous use of protocol member with 5.1 #53591

keith opened this issue Jul 24, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression source compatibility swift 5.1

Comments

@keith
Copy link
Collaborator

keith commented Jul 24, 2019

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

@belkadan
Copy link
Contributor

It is a source compat break, but that does look ambiguous to me. @xedin?

@swift-ci create

@xedin
Copy link
Member

xedin commented Jul 25, 2019

Hm, I don’t remember anything in ranking which got changed recently to affect this, I will take a closer look.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression source compatibility swift 5.1
Projects
None yet
Development

No branches or pull requests

4 participants