summaryrefslogtreecommitdiff
path: root/include/ruby/ruby.h
diff options
context:
space:
mode:
authorKoichi ITO <koic.ito@gmail.com>2024-02-29 22:31:00 +0900
committergit <svn-admin@ruby-lang.org>2024-02-29 16:06:40 +0000
commitf8dd2342bf99738e2a8d7a4fa9e31bff186e0d5a (patch)
tree19447b83ab570ddc62cf11ad4a7404e3a91567bc /include/ruby/ruby.h
parent8a918b456c6fe7449dbffc8bfdc321a2969aea58 (diff)
[ruby/prism] Fix an incorrect parsing for `Prism::Translation::Parser`
This PR fixes an incorrect parsing for `Prism::Translation::Parser` when one-line pattern mathing with Ruby 2.7 runtime. ## Expected Parsing should be done based on the specified Ruby parsing version, independent of the Ruby runtime version. When parsing for Ruby 3.3, it should return `:match_pattern_p` node: ```console $ ruby -rprism -rprism/translation/parser33 -ve 'p Prism::Translation::Parser33.parse("foo in bar")' ruby 3.0.6p216 (2023-03-30 revision https://github.com/ruby/prism/commit/23a532679b) [x86_64-darwin19] s(:match_pattern_p, s(:send, nil, :foo), s(:match_var, :bar)) ``` ## Actual When parsing with Ruby 2.7 runtime, `match_pattern` node is returned, even though it is expected to parse for Ruby 3.3: ```console $ ruby -rprism -rprism/translation/parser33 -ve 'p Prism::Translation::Parser33.parse("foo in bar")' ruby 2.7.8p225 (2023-03-30 revision https://github.com/ruby/prism/commit/1f4d455848) [x86_64-darwin19] s(:match_pattern, s(:send, nil, :foo), s(:match_var, :bar)) ``` The cause was the use of `RUBY_VERSION` for condition logic, which made it dependent on runtime Ruby version. `Prism::Translation::Parser` supports parsing for Ruby 3.3+. Therefore, the condition for parsing Ruby 2.7, which is not supported, is being removed. ## Background Found due to incompatibility with RuboCop's `Layout/SpaceAroundKeyword` and `Style/TernaryParentheses` cops. https://github.com/ruby/prism/commit/e752e251d2
Diffstat (limited to 'include/ruby/ruby.h')
0 files changed, 0 insertions, 0 deletions