Skip to content

Lookahead/parse mismatch: canParseClosureSignature accepts top-level '->' but signature parse fails (missing 'in') #3163

@kwikysw

Description

@kwikysw

Issue Kind

Bad Diagnostic Produced

Source Code

struct Foo {
func a(s: S [{{g) -> Int {}
}}}

Description

Following #3162, the following code in function testRecovery141 of RecoveryTests gives the following diagnostics: "expected 'in' in closure signature" at the arrow location, and "unexpected code ') -> Int {}' in closure". However, lookahead shouldn't accept a closure signature here, or the parse should consume consistently, instead of having a mismatch between lookahead and the actual parse.

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