From 35a29390197750abf97ef16fa0740e377764daef Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 15 Oct 2016 05:17:07 +0000 Subject: vm_args.c: allow refinements in Symbol proc * vm_args.c (refine_sym_proc_call): search and call method with refinements. * vm_args.c (vm_caller_setup_arg_block): enable refinements when enabled in the caller. [Feature #9451] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_symbol.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby/test_symbol.rb') diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index d8c91c1eea..a135338edb 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -435,4 +435,16 @@ class TestSymbol < Test::Unit::TestCase assert_equal str, str.to_sym.to_s assert_not_predicate(str, :frozen?, bug11721) end + + module WithRefinements + using Module.new {refine(Integer) {alias inc succ}} + def mapinc(a) + a.map(&:inc) + end + end + + def test_proc_with_refinements + obj = Object.new.extend WithRefinements + assert_equal [*1..3], obj.mapinc(0..2) + end end -- cgit v1.2.3