Skip to content

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

Closed
@whiteio

Description

@whiteio

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    SwiftParserBugs in the (new) Parser written in SwiftbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions