Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected self on ensure when yield without block #3175

Closed
ksss opened this issue Jul 14, 2016 · 0 comments
Closed

Unexpected self on ensure when yield without block #3175

ksss opened this issue Jul 14, 2016 · 0 comments

Comments

@ksss
Copy link
Contributor

@ksss ksss commented Jul 14, 2016

I think, close should be called by instance of A.
But now, it's called by one upper stack.

t.rb

class A
  def open
    yield
  ensure
    close
  end

  def close
    puts "close"
  end
end

A.new.open

Actual

$ ./build/host-debug/bin/mruby t.rb
trace:
    [0] t.rb:5
t.rb:5: undefined method 'close' for main (NoMethodError)

Expect

$ ./build/host-debug/bin/mruby t.rb
close
trace:
    [0] t.rb:3
LocalJumpError: unexpected yield

Env

$ git rev-parse HEAD
d4d807b774de0e776d2749acbcb22a1b38f1c50b

$ uname -v
Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64

$ clang --version
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Refs

#3173

Thanks!

@matz matz closed this as completed in 6c299aa Nov 6, 2016
matz added a commit that referenced this issue Dec 7, 2017
The code was introduced to address #3175 but it's no longer needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant