From: "eightbitraptor (Matthew Valentine-House) via ruby-core" Date: 2023-12-19T13:52:12+00:00 Subject: [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 - undefined method `tap' for main :in `': 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/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/