From 6d886eb2557fe846957da483ab08f7c964e95679 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 17 Oct 2014 04:13:38 +0000 Subject: merge revision(s) 47645: [Backport #10263] * vm_eval.c (eval_string_with_cref): fix super from eval with scope. set klass in the current control frame to the class of the receiver in the context to be evaluated, this class/module must match the actual receiver to call super. [ruby-core:65122] [Bug #10263] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_super.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index 44fdf850fc..cb76236f9c 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -495,4 +495,19 @@ class TestSuper < Test::Unit::TestCase end assert_equal(%w[B A], result, bug9721) end + + def test_from_eval + bug10263 = '[ruby-core:65122] [Bug #10263a]' + a = Class.new do + def foo + "A" + end + end + b = Class.new(a) do + def foo + binding.eval("super") + end + end + assert_equal("A", b.new.foo, bug10263) + end end -- cgit v1.2.3