[#114774] [Ruby master Feature#19884] Make Safe Navigation Operator work on classes — "p8 (Petrik de Heus) via ruby-core" <ruby-core@...>
Issue #19884 has been reported by p8 (Petrik de Heus).
13 messages
2023/09/15
[ruby-core:114628] [Ruby master Bug#19862] argument stack underflow compile error happens for the combination of and/or & one line pattern matching
From:
"yui-knk (Kaneko Yuichiro) via ruby-core" <ruby-core@...>
Date:
2023-09-05 10:05:40 UTC
List:
ruby-core #114628
Issue #19862 has been reported by yui-knk (Kaneko Yuichiro).
----------------------------------------
Bug #19862: argument stack underflow compile error happens for the combination of and/or & one line pattern matching
https://bugs.ruby-lang.org/issues/19862
* Author: yui-knk (Kaneko Yuichiro)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0dev (2023-09-04T18:01:33Z master db3b814cb0) [arm64-darwin21]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
This code raises argument stack underflow compile error on ruby 3.3 which is under development.
```ruby
# test3.rb
if true or {a: 0} in {a:}
p 1
else
p 0
end
```
```shell
% ruby -v test3.rb
ruby 3.3.0preview1 (2023-05-12 master a1b01e7701) [arm64-darwin21]
test3.rb:2: warning: assigned but unused variable - a
-- raw disasm--------
trace: 1
0000 jump <L000> ( 2)
<L006> [sp: 0]
<L004> [sp: 0]
* 0002 pop ( 2)
0003 pop ( 2)
0004 jump <L001> ( 2)
<L000> [sp: 0]
trace: 1
0006 putself ( 3)
0007 putobject_INT2FIX_1_ ( 3)
0008 opt_send_without_block <calldata:p, 1> ( 3)
0010 leave ( 5)
<L001> [sp: -1]
trace: 1
0011 putself ( 5)
0012 putobject_INT2FIX_0_ ( 5)
0013 opt_send_without_block <calldata:p, 1> ( 5)
0015 leave ( 5)
---------------------
test3.rb:2: argument stack underflow (-1)
test3.rb: compile error (SyntaxError)
% ./ruby -v ../../test3.rb
ruby 3.3.0dev (2023-09-04T18:01:33Z master db3b814cb0) [arm64-darwin21]
`RubyGems' were not loaded.
`error_highlight' was not loaded.
`did_you_mean' was not loaded.
`syntax_suggest' was not loaded.
../../test3.rb:2: warning: assigned but unused variable - a
-- raw disasm--------
trace: 1
0000 jump <L000> ( 2)
<L006> [sp: 0]
<L004> [sp: 0]
* 0002 pop ( 2)
0003 pop ( 2)
0004 jump <L001> ( 2)
<L000> [sp: 0]
trace: 1
0006 putself ( 3)
0007 putobject_INT2FIX_1_ ( 3)
0008 opt_send_without_block <calldata:p, 1> ( 3)
0010 leave ( 5)
<L001> [sp: -1]
trace: 1
0011 putself ( 5)
0012 putobject_INT2FIX_0_ ( 5)
0013 opt_send_without_block <calldata:p, 1> ( 5)
0015 leave ( 5)
---------------------
../../test3.rb:2: argument stack underflow (-1)
../../test3.rb: compile error (SyntaxError)
```
This also raises same error.
```ruby
# test4.rb
if false and {a: 0} in {a:}
p 1
else
p 0
end
```
As far as I checked, 3.0.0, 3.1.0, 3.2.0 don't raise the error.
--
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/postorius/lists/ruby-core.ml.ruby-lang.org/