Skip to content

Wrong diagnostics for ternary expression when only the colon is missing #1624

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

Closed
whiteio opened this issue May 1, 2023 · 1 comment · Fixed by #1677
Closed

Wrong diagnostics for ternary expression when only the colon is missing #1624

whiteio opened this issue May 1, 2023 · 1 comment · Fixed by #1677
Labels
bug Something isn't working SwiftParser Bugs in the (new) Parser written in Swift

Comments

@whiteio
Copy link
Contributor

whiteio commented May 1, 2023

Description

When diagnostics are generated for ternary expressions where the : is missing but both of the first and second choice expressions are present, the incorrect diagnostic message is used and the wrong Fix-It is applied.

Steps to Reproduce

Example:

foo ? 1 2

This results in the following diagnostic message and Fix-It:

expected ':' and expression after '? ...' in ternary expression
foo ? 1 : <#expression#>2

As the expression isn't missing in the example I expected the following diagnostic message and Fix-It:

expected ':' after '? ...' in ternary expression
foo ? 1 : 2
@whiteio whiteio added the bug Something isn't working label May 1, 2023
@ahoppen
Copy link
Member

ahoppen commented May 1, 2023

Tracked in Apple’s issue tracker as rdar://108750446

@ahoppen ahoppen added the SwiftParser Bugs in the (new) Parser written in Swift label May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SwiftParser Bugs in the (new) Parser written in Swift
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants