Skip to content

Conversation

@bhanage-viraj
Copy link

Description

Fixes #3163.

The canParseClosureSignature lookahead was previously accepting signatures that started with -> or ) even if the preceding parameter list was invalid or unbalanced (e.g., missing an opening parenthesis).

This change ensures that canParseClosureSignature only consumes a closing parenthesis ) if it successfully consumed a matching opening parenthesis (.

Risk

Low. This strictly tightens the lookahead logic for invalid syntax.

Testing

Added a regression test in Issue3163Tests.swift ensuring the "expected 'in' in closure signature" diagnostic no longer appears for the reproduction case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant