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-9200] func foo(_: @autoclosure () -> T) does not satisfy func foo(T) in protocol #51691

Open
Dante-Broggi opened this issue Nov 6, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself feature A feature request or implementation

Comments

@Dante-Broggi
Copy link
Contributor

Previous ID SR-9200
Radar None
Original Reporter @Dante-Broggi
Type Bug
Environment

The Xcode 10.1 toolchain.

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, LanguageFeatureRequest
Assignee None
Priority Medium

md5: 8072d29fd94b4c509158fb207fb9daf3

Issue Description:

This would be fine, except there is no obvious way to conform to the protocol.

protocol Foo {
    func foo(_: Int)
}

struct Bar: Foo {
// fixit: (without body)
//  func foo(_ t: Int) {
//      foo(t) // recursive call (want the `func foo(_: @autoclosure () -> T)` version)
//  }
    
    func foo(_: @autoclosure () -> Int) {
        
    }
}
@belkadan
Copy link
Contributor

belkadan commented Nov 7, 2018

And even if it weren't a recursive call, it'd be ambiguous at the use site.

This probably has to at least get a pitch on the forums to change, but it's possible the core team will decide it doesn't need a full proposal. I don't know how easy it is to implement.

@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 feature A feature request or implementation
Projects
None yet
Development

No branches or pull requests

2 participants