* [ruby-core:121141] [Ruby master Bug#21153] ::Foo ||= p 1 should parse
@ 2025-02-23 1:28 qnighy (Masaki Hara) via ruby-core
2025-02-25 8:28 ` [ruby-core:121155] " nobu (Nobuyoshi Nakada) via ruby-core
2025-03-03 23:08 ` [ruby-core:121230] " k0kubun (Takashi Kokubun) via ruby-core
0 siblings, 2 replies; 3+ messages in thread
From: qnighy (Masaki Hara) via ruby-core @ 2025-02-23 1:28 UTC (permalink / raw)
To: ruby-core; +Cc: qnighy (Masaki Hara)
Issue #21153 has been reported by qnighy (Masaki Hara).
----------------------------------------
Bug #21153: ::Foo ||= p 1 should parse
https://bugs.ruby-lang.org/issues/21153
* Author: qnighy (Masaki Hara)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-02-22T15:11:40Z master fd882fb681) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
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/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:121155] [Ruby master Bug#21153] ::Foo ||= p 1 should parse
2025-02-23 1:28 [ruby-core:121141] [Ruby master Bug#21153] ::Foo ||= p 1 should parse qnighy (Masaki Hara) via ruby-core
@ 2025-02-25 8:28 ` nobu (Nobuyoshi Nakada) via ruby-core
2025-03-03 23:08 ` [ruby-core:121230] " k0kubun (Takashi Kokubun) via ruby-core
1 sibling, 0 replies; 3+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2025-02-25 8:28 UTC (permalink / raw)
To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)
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/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:121230] [Ruby master Bug#21153] ::Foo ||= p 1 should parse
2025-02-23 1:28 [ruby-core:121141] [Ruby master Bug#21153] ::Foo ||= p 1 should parse qnighy (Masaki Hara) via ruby-core
2025-02-25 8:28 ` [ruby-core:121155] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2025-03-03 23:08 ` k0kubun (Takashi Kokubun) via ruby-core
1 sibling, 0 replies; 3+ messages in thread
From: k0kubun (Takashi Kokubun) via ruby-core @ 2025-03-03 23:08 UTC (permalink / raw)
To: ruby-core; +Cc: k0kubun (Takashi Kokubun)
Issue #21153 has been updated by k0kubun (Takashi Kokubun).
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 commit:8d2be590ad567b7b03286731f9a9754d24370f00.
----------------------------------------
Bug #21153: ::Foo ||= p 1 should parse
https://bugs.ruby-lang.org/issues/21153#change-112180
* 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: DONE
----------------------------------------
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/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-03 23:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-23 1:28 [ruby-core:121141] [Ruby master Bug#21153] ::Foo ||= p 1 should parse qnighy (Masaki Hara) via ruby-core
2025-02-25 8:28 ` [ruby-core:121155] " nobu (Nobuyoshi Nakada) via ruby-core
2025-03-03 23:08 ` [ruby-core:121230] " k0kubun (Takashi Kokubun) via ruby-core
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).