Closed koic closed 9 months ago
Incompatibility AST for modifier rescue around parallel assignment between Parser gem and Prism:
rescue
a, b = 1, 2 rescue nil
This is an AST starting from masgn:
masgn
$ ruby -rparser/ruby33 -ve 'p Parser::Ruby33.parse("a, b = 1, 2 rescue nil")' ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin22] s(:masgn, s(:mlhs, s(:lvasgn, :a), s(:lvasgn, :b)), s(:rescue, s(:array, s(:int, 1), s(:int, 2)), s(:resbody, nil, nil, s(:nil)), nil))
This is an AST starting from rescue:
$ ruby -rprism -rprism/translation/parser -ve 'p Prism::Translation::Parser.parse("a, b = 1, 2 rescue nil")' ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin22] s(:rescue, s(:masgn, s(:mlhs, s(:lvasgn, :a), s(:lvasgn, :b)), s(:array, s(:int, 1), s(:int, 2))), s(:resbody, nil, nil, s(:nil)), nil)
Found due to incompatibility with RuboCop's Style/RescueModifier cop.
Style/RescueModifier
I apologize. I reported to the wrong place.
Incompatibility AST for modifier
rescue
around parallel assignment between Parser gem and Prism:Expected Behavior
This is an AST starting from
masgn
:Actual Behavior
This is an AST starting from
rescue
:Background
Found due to incompatibility with RuboCop's
Style/RescueModifier
cop.