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-11619] Spurious error "anonymous closure argument not contained in a closure" in #if false #54030

DougGregor opened this issue Oct 16, 2019 · 3 comments


Copy link

@DougGregor DougGregor commented Oct 16, 2019

Previous ID SR-11619
Radar None
Original Reporter @DougGregor
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, StarterBug
Assignee None
Priority Medium

md5: fce0a8071c3d74595e44fbbd42aa3fa0

Issue Description:

This code currently produces an error, but shouldn't:

#if false
if $0 { } // error: anonymous closure argument not contained in a closure
Copy link

@belkadan belkadan commented Oct 16, 2019

I'm not sure it shouldn't. Code in false branches of ifs still has to parse unless the guard is #if swift or #if compiler. It's fuzzy whether this is a parse error or a semantic error, though.

Copy link

@swift-ci swift-ci commented Nov 17, 2019

Comment by Tapan Thaker (JIRA)

Just checked, this is a parse error. Happens at ParseExpr.cpp#L2863.
So does this mean we good to close this issue?

Copy link
Member Author

@DougGregor DougGregor commented Nov 18, 2019

I consider this a bug, because I think the error should come from semantic analysis, not from the parser.

@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
None yet

No branches or pull requests

3 participants