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-2705] Need rule and error on overloads WRT @autoclosure #45309

Closed
milseman mannequin opened this issue Sep 20, 2016 · 1 comment
Closed

[SR-2705] Need rule and error on overloads WRT @autoclosure #45309

milseman mannequin opened this issue Sep 20, 2016 · 1 comment
Assignees
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

@milseman
Copy link
Mannequin

milseman mannequin commented Sep 20, 2016

Previous ID SR-2705
Radar None
Original Reporter @milseman
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, LanguageFeatureRequest
Assignee @milseman
Priority Medium

md5: a89ca81974b881b21425d28c9cc713b6

Issue Description:

We currently allow the following declarations:

func autoclosure(f: () -> Int) { }
func autoclosure(f: @autoclosure () -> Int) { }
func autoclosure(f: Int) { }

But, this is very troublesome, as how does one go about calling it? We need a consistent ruling here as well as enforcement. The trouble actually cuts both ways:

func callIt() {
  foo(f: { return 1 }) // <-- error: ambiguous use of 'autoclosure(f:)'
  let foo = autoclosure as (() -> (Int)) -> () // <-- no error, but which one is it?
}
@xedin
Copy link
Member

xedin commented Feb 24, 2021

Fixed by #36076 on main. @milseman Please use the next available snapshot of main branch to verify and close.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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

1 participant