You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
jrubyc-compiled code with an array pattern fails to load (NullPointerException reading persisted IR) #9834
A file compiled with jrubyc that uses an array pattern can't be loaded. Loading the .class file fails while reading the persisted IR:
# arr.rbp([1]in[1])
$ jrubyc arr.rb
$ mkdir only && mv arr.class only/
$ jruby -e 'load "only/arr.class"'
Unhandled Java exception: java.lang.NullPointerException: Cannot invoke "org.jruby.ir.operands.OperandType.ordinal()" because "type" is null
The same file without the pattern, or with a hash pattern like {a: 1} in {a: 1}, loads and prints true. It fails the same way on 9.4.15.0, 10.1.2.0 and master. These all fail:
[1] in [1] and [1] in [Integer]
[1, 2] in [_, 2] and [1, *] in [1, *]
case [1]; in [x] then p x; end
With -Xir.reading.debug=true, the last operand read before the failure is a temporary variable that decodes to null, after which the reader is out of step with the data:
Array patterns use TemporaryIntVariables for the array's length, the rest count and element indexes (IRBuilder#intTemp). It's written with type INT, but TemporaryLocalVariable.decode has no case for INT, so it falls through to return null:
Activity
Read the instructions array patterns use from persisted IR
Read the instructions array patterns use from persisted IR
Read the instructions array patterns use from persisted IR