Skip to content

Fix parser translator when splatting in pattern matching pin#3529

Merged
kddnewton merged 1 commit into
ruby:mainfrom
Earlopain:parser-translator-splat-in-pin
Apr 2, 2025
Merged

Fix parser translator when splatting in pattern matching pin#3529
kddnewton merged 1 commit into
ruby:mainfrom
Earlopain:parser-translator-splat-in-pin

Conversation

@Earlopain

Copy link
Copy Markdown
Collaborator

Fixes rubocop/rubocop#14056 because it ends up treating it as a local variable, and a.x is not a valid local variable name.

I'm not big on pattern matching, but conceptually it makes sense to me to treat anything inside ^() to not be
pattern matching syntax?

@kddnewton kddnewton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is definitely the correct fix. Would you mind rebasing?

Because it ends up treating it as a local variable, and `a.x`
is not a valid local variable name.

I'm not big on pattern matching, but conceptually it makes sense to me
to treat anything inside ^() to not be
pattern matching syntax?
@Earlopain
Earlopain force-pushed the parser-translator-splat-in-pin branch from 343584f to 80dbd85 Compare March 30, 2025 18:53
@kddnewton
kddnewton merged commit f2443cf into ruby:main Apr 2, 2025
@Earlopain
Earlopain deleted the parser-translator-splat-in-pin branch April 4, 2025 07:44
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.

False positibe Lint/Syntax on pattern matching and splat operator applied to method result

2 participants