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>
This commit is contained in:
Nick Dower 2025-01-02 17:24:55 +01:00 committed by Alan Wu
parent c936699431
commit 37356b713c
Notes: git 2025-01-04 17:53:38 +00:00

View File

@ -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] },