Skip to content

[Truffle] Argument values assigned to local variables not available in block #2999

Closed
@nirvdrum

Description

@nirvdrum

Argument values assigned to local variables aren't available from blocks supplied to a method call. The following is a simplified example of something RSpec does:

def x(the_caller)
  yield
end

class X
  def y
    x(the_caller = caller) do
      p the_caller.first
    end
  end
end

X.new.y

MRI 2.2.2:

> ruby -v yo.rb 
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
"yo.rb:13:in `<main>'"

JRuby+Truffle:

> bin/jruby -X+T -v yo.rb 
jruby 9.0.0.0-SNAPSHOT (2.2.2) 2015-05-28 6ab4b4a Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
yo.rb:8:in `method_missing': undefined method `first' for NilClass (NoMethodError)
    from yo.rb:8:in `block in y'
    from yo.rb:2:in `x'
    from yo.rb:7:in `y'
    from yo.rb:13:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions