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-2053] [Regression] Using @noescape for a type aliased closure results in a compile error #44662

Closed
0xpablo opened this issue Jul 12, 2016 · 4 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 3.0

Comments

@0xpablo
Copy link

0xpablo commented Jul 12, 2016

Previous ID SR-2053
Radar None
Original Reporter @0xpablo
Type Bug
Status Resolved
Resolution Done
Environment

Apple Swift version 3.0 (swiftlang-800.0.33.1 clang-800.0.31) (Xcode 8 beta 2)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 3.0Regression
Assignee @slavapestov
Priority Medium

md5: 791693fc805f219336b93066cbd69027

is duplicated by:

relates to:

Issue Description:

Since @noescape is now an attribute on the type, using it with type aliased closures results in a compiler error.

Code example:

typealias Handler = () -> ()

func foo(handler: @noescape Handler) { }

Error:

{code:bgColor=#FFFFFF| borderColor=#FF0000|borderWidth=2}
error: @NoEscape attribute only applies to function types
func foo(handler: @NoEscape Handler)
^

@lattner
Copy link
Mannequin

lattner mannequin commented Jul 12, 2016

Ok, this is a known limitation in the compiler. It is definitely possible to extend this, but keep in mind that @NoEscape is supposed to go away in Swift 3. The issue will still exist though with the new @escaping attribute.

@belkadan
Copy link
Contributor

@milseman, there's a Radar for this too, right?

@slavapestov
Copy link
Member

PR fo 3.0: PR for 3.0: #4388

@slavapestov
Copy link
Member

Fix is now in master and swift-3.0-branch.

@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 regression swift 3.0
Projects
None yet
Development

No branches or pull requests

4 participants