Project

General

Profile

Actions

Bug #20073

closed

Method lookup incorrect with `--parser=prism`

Added by eightbitraptor (Matt V-H) 11 months ago. Updated 11 months 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

Also available in: Atom PDF

Like0
Like1