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
RubyVM::InstructionSequence.compile_file uses parse.y instead of prism when called from IRB #1212
putsRUBY_DESCRIPTIONFile.write("/tmp/prism-repro.rb",<<~'RUBY') def foo(bars) case bars in [one, "a" | "b" => two] puts "#{one} - #{two}" end endRUBYRubyVM::InstructionSequence.compile_file("/tmp/prism-repro.rb")
Result:
ruby 4.0.2 (2026-03-17 revision d3da9fec82) +PRISM [arm64-darwin25]
(irb):21:in 'RubyVM::InstructionSequence.compile_file':
/tmp/prism-repro.rb:3: alternative pattern after variable capture (SyntaxError)
in [one, "a" | "b" => two]
^
from (irb):21:in '<main>'
from /Users/byroot/.gem/rubies/4.0.2/gems/irb-1.18.0/exe/irb:9:in '<top (required)>'
from /opt/rubies/4.0.2/lib/ruby/4.0.0/rubygems.rb:304:in 'Kernel#load'
from /opt/rubies/4.0.2/lib/ruby/4.0.0/rubygems.rb:304:in 'Gem.activate_and_load_bin_path'
from /Users/byroot/.gem/rubies/4.0.2/bin/irb:25:in '<main>'
This is failing because in Ruby 4.0.2parse.y has a bug, but the important part here is that this is using parse.y even though the default Ruby parser in that session is supposed to be prism.
Interestingly, RubyVM::InstructionSequence.compile doesn't seem to have this problem.
Activity
byroot commentedon May 4, 2026
Nevermind, seem to be caused by ruby/ruby#16463, I'll ask for a backport.