From a71ee2ce41e7f698cdc01d59816de6fe24775850 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 9 Sep 2013 07:56:02 +0000 Subject: vm_method.c: clear cache after refine method * vm_method.c (rb_add_refined_method_entry): clear cache in the refined class since refining a method entry is modifying the class. [ruby-core:57079] [Bug #8880] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_refinement.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 8efbb1a85a..02193ae615 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -982,6 +982,29 @@ class TestRefinement < Test::Unit::TestCase RUBY end + def test_refine_after_using + assert_separately([], <<-"end;") + bug8880 = '[ruby-core:57079] [Bug #8880]' + module Test + refine(String) do + end + end + using Test + def t + 'Refinements are broken!'.chop! + end + t + module Test + refine(String) do + def chop! + self.sub!(/broken/, 'fine') + end + end + end + assert_equal('Refinements are fine!', t, bug8880) + end; + end + private def eval_using(mod, s) -- cgit v1.2.3