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

Open
DougGregor opened this issue Oct 16, 2019 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself good first issue Good for newcomers

Comments

@DougGregor
Copy link
Member

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
#endif
@belkadan
Copy link
Contributor

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.

@swift-ci
Copy link
Contributor

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?

@DougGregor
Copy link
Member Author

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
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants