Project

General

Profile

Actions

Bug #20073

closed

Method lookup incorrect with `--parser=prism`

Added by eightbitraptor (Matt V-H) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:115793]

Description

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.

Actions #1

Updated by tenderlovemaking (Aaron Patterson) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|df0bfde2b29b7e8dac333b2a775ab8bff1283a5c.


We need to load builtins so that they work

Before this commit no methods defined in Ruby were being loaded. For
example class or tap methods would not exist.

[ruby-core:115793] [Bug #20073]

Actions

Also available in: Atom PDF

Like0
Like1