-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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-5719] Ban autoclosure forwarding #48289
Comments
Oh dear. This seems to have been the result of a bad conditional left over when fixing SR-832. |
To expand: The rules for matching parallel @autoclosure function types are
The condition in |
Yet it's an abuse of a bug, similar like some people abuse guard let `self` = self else { ... } in closures with `weak` self. I see two options (there is third one, but I won't be happy with it in a long term):
func foo() -> Int { return 42 }
func bar(_ c: @autoclosure () -> Int) { ... }
bar(foo) This would allow us to specify autoclosures with default reference to another function/closure: func foo() -> Int { return 42 }
func bar(_ c: @autoclosure () -> Int = foo) { ... }
bar()
|
I think it does need to go to swift-evolution, since it will break existing code. A core team member could rule that it doesn't need a full review, but it should at least come up there. |
@swift-ci create |
@autoclosure forwarding has been banned starting from `swift-version 5`. |
Environment
Xcode 8.3.3
Additional Detail from JIRA
md5: 401a3fa1c8f5f08e5385cee515f04b79
is duplicated by:
()
Issue Description:
If this requires a full review on the evolution side, let me know, I'll start a new thread.
The text was updated successfully, but these errors were encountered: