feat: support the it block parameter#2238
Open
tk0miya wants to merge 1 commit into
Open
Conversation
tk0miya
commented
Jun 13, 2026
|
|
||
| def self.new_parser | ||
| Prism::Translation::Parser33.new(Builder.new).tap do |parser| | ||
| Prism::Translation::Parser34.new(Builder.new).tap do |parser| |
Contributor
Author
There was a problem hiding this comment.
Discussion: I bumped the Prism parser from Parser33 to Parser34 to support the it parameter.
But this introduces incompatible behavior.
ruby def it 1 end [1, 2, 3].map { it }
With Parser33, the it inside the block is recognized as a method call to #it. With Parser34, the same it is recognized as the block's implicit parameter.
I'm afraid that this brings a breaking change. Would it be better to add a configuration for the Ruby syntax version?
b172612 to
db29dfe
Compare
Recognize Ruby 3.4's `it` (e.g. `[1].map { it + 1 }`) by handling
the new :itblock node alongside :numblock across type checking,
source mapping, diagnostics, hover, and signature help.
This requires bumping Prism::Translation::Parser33 to Parser34.
Closes soutaro#1450
db29dfe to
3e1cf45
Compare
This was referenced Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recognize Ruby 3.4's
it(e.g.[1].map { it + 1 }) by handling the new :itblock node alongside :numblock across type checking, source mapping, diagnostics, hover, and signature help.This requires bumping Prism::Translation::Parser33 to Parser34.
Closes #1450