$ ruby-parse -e 'if foo..; end'
Failed on: (fragment:0)
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/parser-3.2.2.3/lib/parser/builders/default.rb:1676:
in `check_condition': undefined method `type' for nil (NoMethodError)
case cond.type
^^^^^
from /Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/parser-3.2.2.3/lib/parser/builders/default.rb:1707:
in `check_condition'
from /Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/parser-3.2.2.3/lib/parser/builders/default.rb:1275:
in `condition'
I'm not sure if there's any significance to using the flip-flop syntax with nil, but by using beginless or endless ranges and explicitly specifying nil, the following current behaviors are made compatible:
This PR resolves https://github.com/rubocop/rubocop/issues/12198.
I'm not sure if there's any significance to using the flip-flop syntax with
nil
, but by using beginless or endless ranges and explicitly specifyingnil
, the following current behaviors are made compatible:iflipflop
with explicitlynil
eflipflop
with explicitlynil
The difference in the flip-flop with beginless or endless ranges is that
s(:nil)
is replaced bynil
in the flip-flop ASTs.This is reflected in the tests.