diff options
| author | Nick Dower <nicholasdower@gmail.com> | 2025-01-02 17:24:55 +0100 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2025-02-13 17:37:38 -0800 |
| commit | cefa630bce3aea8317f09fe73c6439f67c42bb69 (patch) | |
| tree | b4cb308871ce0829ccc17fb16175ea2783f43d8d | |
| parent | 65f2a4beecd3017ced366e3957eef501f2860c1f (diff) | |
YJIT: Add crashing test for yielding keyword args
Code like the following is crashing for us on 3.4.1:
```ruby
def a(&) = yield(x: 0)
1000.times { a { |x:| x } }
```
Crash:
```
ruby: YJIT has panicked. More info to follow...
thread '<unnamed>' panicked at ./yjit/src/codegen.rs:8018:13:
assertion `left == right` failed
left: 0
right: 1
```
Co-authored-by: Dani Acherkan <dtl.117@gmail.com>
| -rw-r--r-- | bootstraptest/test_yjit.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 6a1aebccd7..8c6171bd0a 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -37,27 +37,35 @@ assert_equal "ok", %q{ } # test discarding extra yield arguments -assert_equal "2210150001501015", %q{ +assert_equal "22131300500015901015", %q{ def splat_kw(ary) = yield *ary, a: 1 def splat(ary) = yield *ary - def kw = yield 1, 2, a: 0 + def kw = yield 1, 2, a: 3 + + def kw_only = yield a: 0 def simple = yield 0, 1 + def none = yield + def calls [ splat([1, 1, 2]) { |x, y| x + y }, splat([1, 1, 2]) { |y, opt = raise| opt + y}, splat_kw([0, 1]) { |a:| a }, kw { |a:| a }, - kw { |a| a }, + kw { |one| one }, + kw { |one, a:| a }, + kw_only { |a:| a }, + kw_only { |a: 1| a }, simple { 5.itself }, simple { |a| a }, simple { |opt = raise| opt }, simple { |*rest| rest }, simple { |opt_kw: 5| opt_kw }, + none { |a: 9| a }, # autosplat ineractions [0, 1, 2].yield_self { |a, b| [a, b] }, [0, 1, 2].yield_self { |a, opt = raise| [a, opt] }, |
