
Issue #21153 has been updated by nobu (Nobuyoshi Nakada). The backport patch to 3.4 is https://github.com/ruby/ruby/pull/12805 ---------------------------------------- Bug #21153: ::Foo ||= p 1 should parse https://bugs.ruby-lang.org/issues/21153#change-112094 * Author: qnighy (Masaki Hara) * Status: Closed * ruby -v: ruby 3.5.0dev (2025-02-22T15:11:40Z master fd882fb681) +PRISM [x86_64-linux] * Backport: 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED ---------------------------------------- There is an inconsistency between how `Foo` and `::Foo` are handled: ```console % ./miniruby --parser=parse.y -e "Foo ||= p 1" 1 % ./miniruby --parser=parse.y -e "::Foo ||= p 1" -e:1: syntax error, unexpected integer literal, expecting 'do' or '{' or '(' ::Foo ||= p 1 ./miniruby: compile error (SyntaxError) ``` Note that `Object::Foo` also parses. Prism successfully parses both, which is what I expect. ```console % ./miniruby --parser=prism -e "Foo ||= p 1" 1 % ./miniruby --parser=prism -e "::Foo ||= p 1" 1 ``` To fix this, you should probably handle all tOP_ASGNs in the op_asgn rule. -- https://bugs.ruby-lang.org/