[ruby-core:115793] [Ruby master Bug#20073] Method lookup incorrect with `--parser=prism`

Issue #20073 has been reported by eightbitraptor (Matthew Valentine-House). ---------------------------------------- Bug #20073: Method lookup incorrect with `--parser=prism` https://bugs.ruby-lang.org/issues/20073 * Author: eightbitraptor (Matthew Valentine-House) * Status: Open * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- The following code works with both CRuby's compiler and Prism when evaluated using `RubyVM::InstructionSequence` ``` ~/git/ruby master ≡ ❯ ./miniruby -d -e'p RubyVM::InstructionSequence.compile_prism("tap { }").eval' main ~/git/ruby master ≡ ❯ ./miniruby -d -e'p RubyVM::InstructionSequence.compile("tap { }").eval' main ``` However when using the command line `--parser=prism` flag it results in a `NoMethodError` attempting to find `tap`, whereas CRuby's parser does not. ``` ~/git/ruby master ≡ ❯ ./miniruby -d -e'p tap { }' main ~/git/ruby master ≡ ❯ ./miniruby --parser=prism -d -e'p tap { }' ./miniruby: warning: The compiler based on the Prism parser is currently experimental and compatibility with the compiler based on parse.y is not yet complete. Please report any issues you find on the `ruby/prism` issue tracker. Exception `NoMethodError' at <compiled> - undefined method `tap' for main <compiled>:in `<compiled>': undefined method `tap' for main (NoMethodError) ``` This appears to be because the toplevel binding context is not being prepended to the linked list of instruction sequences when `--parser=prism` is passed. -- https://bugs.ruby-lang.org/
participants (1)
-
eightbitraptor (Matthew Valentine-House)