Skip to content

Commit 53053bc

Browse files
committed
* vm_insnhelper.c (vm_call_method): stop method search when a method
is not found in a refinement, to support undef in refinements. [ruby-core:66741] [Bug ruby#10578] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 25dda42 commit 53053bc

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Tue Feb 10 11:38:28 2015 Shugo Maeda <shugo@ruby-lang.org>
2+
3+
* vm_insnhelper.c (vm_call_method): stop method search when a method
4+
is not found in a refinement, to support undef in refinements.
5+
[ruby-core:66741] [Bug #10578]
6+
17
Tue Feb 10 11:19:11 2015 Shugo Maeda <shugo@ruby-lang.org>
28

39
* lib/net/ftp.rb (chdir, delete, gettextfile, mdtm, mkdir, nlst,

test/ruby/test_refinement.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,19 @@ def test_instance_methods_not_include_superclass_method
13871387
:foo, bug10826)
13881388
end
13891389

1390+
def test_undef_original_method
1391+
assert_in_out_err([], <<-INPUT, ["NoMethodError"], [])
1392+
module NoPlus
1393+
refine String do
1394+
undef +
1395+
end
1396+
end
1397+
1398+
using NoPlus
1399+
"a" + "b" rescue p($!.class)
1400+
INPUT
1401+
end
1402+
13901403
private
13911404

13921405
def eval_using(mod, s)

vm_insnhelper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,10 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
17521752
goto start_method_dispatch;
17531753
}
17541754
}
1755+
else {
1756+
ci->me = 0;
1757+
goto start_method_dispatch;
1758+
}
17551759

17561760
no_refinement_dispatch:
17571761
if (ci->me->def->body.orig_me) {

0 commit comments

Comments
 (0)