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-10714] Should have better diagnostic for "#else if" #53111

Closed
beccadax opened this issue May 18, 2019 · 1 comment
Closed

[SR-10714] Should have better diagnostic for "#else if" #53111

beccadax opened this issue May 18, 2019 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers

Comments

@beccadax
Copy link
Contributor

Previous ID SR-10714
Radar None
Original Reporter @beccadax
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, StarterBug
Assignee owenvoorhees (JIRA)
Priority Medium

md5: eff0f8afe832c40b86072c7a0ab3413f

Issue Description:

Test case:

#if A
#else if B
#else
#endif

Diagnostics:

<stdin>:2:7: error: extra tokens following conditional compilation directive
#else if B
      ^ 
<stdin>:2:11: error: expected '{' after 'if' condition 
#else if B
         ^
<stdin>:3:1: error: further conditions after #else are unreachable
#else
^
<stdin>:2:10: error: use of unresolved identifier 'B'
#else if B
         ^ 

It'd be better to recognize the "if" after "#else" and suggest it be replaced with "#elseif", and then suppress the remaining diagnostics.

@swift-ci
Copy link
Collaborator

Comment by Owen Voorhees (JIRA)

Fixed this a little while back in [[Parse] Improve diagnostic and add fixit to correct '#else if' to '#elseif'|#25008], marking as resolved

@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 diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants