Bug #20204 closed
3.3.0 YJIT rises TypeError instead of ArgumentError with some incorrect calls
Added by alanwu (Alan Wu) 12 months ago.
Updated 8 months ago.
Description
Test with:
def foo ( a , * ) = a
def call ( args , & )
foo ( 1 )
foo ( * args , & )
end
call ([ 1 , 2 ])
call ([])
$ ruby ../test.rb
../test.rb:1:in `foo': wrong number of arguments (given 0, expected 1+) (ArgumentError)
$ ruby --yjit-call-threshold=1 ../test.rb
../test.rb:5:in `call': wrong argument type Array (expected Proc) (TypeError)
Status changed from Open to Closed
Applied in changeset git|7f51959ff14fbe06bc1afd283d1af17b26161cf4 .
YJIT: Move guard up for a case of splat+rest
Previously, YJIT put the guard for having enough items to extract from
splat array at a place where the side exit is invalid, so if the guard
fails, YJIT could raise something other than ArgumentError. Move the
guard up to a place before any stack manipulation.
[Bug #20204 ]
Backport changed from 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE
Also available in: Atom
PDF
Like 0
Like 0 Like 0