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-3824] Autoclosure attribute fails with type aliased function #46409

Closed
NachoSoto opened this issue Feb 1, 2017 · 3 comments
Closed

[SR-3824] Autoclosure attribute fails with type aliased function #46409

NachoSoto opened this issue Feb 1, 2017 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@NachoSoto
Copy link
Contributor

Previous ID SR-3824
Radar None
Original Reporter @NachoSoto
Type Bug
Status Resolved
Resolution Duplicate
Environment

Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, TypeChecker
Assignee @NachoSoto
Priority Medium

md5: 7f0bd7d9141ff64ce95deaa718e3b627

is duplicated by:

  • SR-2688 autoclosure does not support closure typealias

Issue Description:

class C {
    typealias X = () -> Void

    // error: @autoclosure attribute only applies to function types
    func f1(x: @autoclosure @escaping X) {}

    // works
    func f2(x: @autoclosure @escaping () -> Void) {}
}
@slavapestov
Copy link
Member

I think ideally @autoclosure would be stored as an attribute of the parameter, and not on the type itself. There are some other issues where @autoclosure shows up in odd places, eg

func foo(fn: @autoclosure @escaping () -> ()) {
  let f = fn // error: expression type '() -> ()' is ambiguous without more context
  let ff: () -> () = fn // works
}

@swift-ci
Copy link
Collaborator

Comment by David Owens (JIRA)

Agree, but this is a duplicate of SR-2688. Been around for a while.

@swift-ci
Copy link
Collaborator

Comment by David Owens (JIRA)

Already been tracking for a bit.

@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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants