Actions
Bug #21153
closed::Foo ||= p 1 should parse
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.5.0dev (2025-02-22T15:11:40Z master fd882fb681) +PRISM [x86_64-linux]
Description
There is an inconsistency between how Foo
and ::Foo
are handled:
% ./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.
% ./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.
Updated by nobu (Nobuyoshi Nakada) 30 days ago
- Status changed from Open to Closed
Applied in changeset git|21ac0a3a640a2a86e8716675f82221f178e29088.
[Bug #21153] Add missing op-assign to top const in command_asgn
It was defined in arg
only; moved that pattern to op_asgn
rule to
share it with command_asgn
.
Updated by nobu (Nobuyoshi Nakada) 29 days ago
- Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED
Updated by nobu (Nobuyoshi Nakada) 29 days ago
The backport patch to 3.4 is https://github.com/ruby/ruby/pull/12805
Updated by ufuk (Ufuk Kayserilioglu) 23 days ago
- Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: DONE
Updated by k0kubun (Takashi Kokubun) 23 days ago
- Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: DONE to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED
Updated by k0kubun (Takashi Kokubun) 23 days ago
- Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: DONE
ruby_3_4 8d2be590ad567b7b03286731f9a9754d24370f00.
Updated by nagachika (Tomoyuki Chikanaga) 10 days ago
- Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: DONE to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: WONTFIX, 3.4: DONE
Actions
Like0
Like0Like0Like1Like0Like0Like0Like0