Skip to content

Fix in handling#3948

Merged
kddnewton merged 1 commit intomainfrom
fix-in-handling
Mar 2, 2026
Merged

Fix in handling#3948
kddnewton merged 1 commit intomainfrom
fix-in-handling

Conversation

@kddnewton
Copy link
Copy Markdown
Collaborator

@kddnewton kddnewton commented Mar 2, 2026

in is a unique keyword because it can be the start of a clause or an infix keyword. We need to be explicitly sure that even though in could close an expression context (the body of another in clause) that we are not also parsing an inline in. The exception is the case of a command call, which can never be the LHS of an expression, and so we must immediately exit.

Fixes #3710
Fixes #3558

in is a unique keyword because it can be the start of a clause or
an infix keyword. We need to be explicitly sure that even though in
_could_ close an expression context (the body of another in clause)
that we are not also parsing an inline in. The exception is the
case of a command call, which can never be the LHS of an expression,
and so we must immediately exit.

[Bug #21925]
[Bug #21674]
@kddnewton kddnewton merged commit 20374ce into main Mar 2, 2026
67 checks passed
@kddnewton kddnewton deleted the fix-in-handling branch March 2, 2026 17:06
@Earlopain
Copy link
Copy Markdown
Collaborator

Thanks for handling this. It looks fine to me and I didn't find any unexpected changes from this.

The code samples from #3558 (comment) are still syntax valid, should be https://bugs.ruby-lang.org/issues/21934 which @tompng openend. I think the original issue from OP in that issue was fixed a while ago with the referenced PR

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.

Incorrectly flattening case statement with in in the in NoMatchingPatternError on hash + parenthesis omission

2 participants