Bug #10744 ยป 0001-proc.c-Kernel-singleton_method-should-not-use-refine.patch
| proc.c | ||
|---|---|---|
|
QUOTE(vid), obj);
|
||
|
}
|
||
|
if (NIL_P(klass = rb_singleton_class_get(obj)) ||
|
||
|
!(me = rb_method_entry_at(klass, id))) {
|
||
|
UNDEFINED_METHOD_ENTRY_P(me = rb_method_entry_at(klass, id)) ||
|
||
|
UNDEFINED_REFINED_METHOD_P(me->def)) {
|
||
|
rb_name_error(id, "undefined singleton method `%"PRIsVALUE"' for `%"PRIsVALUE"'",
|
||
|
QUOTE_ID(id), obj);
|
||
|
}
|
||
| ... | ... | |
|
rb_define_method(rb_cBinding, "receiver", bind_receiver, 0);
|
||
|
rb_define_global_function("binding", rb_f_binding, 0);
|
||
|
}
|
||
| test/ruby/test_refinement.rb | ||
|---|---|---|
|
end;
|
||
|
end
|
||
|
def test_singleton_method_should_not_use_refinements
|
||
|
assert_separately([], <<-"end;")
|
||
|
bug10744 = '[ruby-core:67603] [Bug #10744]'
|
||
|
class C
|
||
|
end
|
||
|
module RefinementBug
|
||
|
refine C.singleton_class do
|
||
|
def foo
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
assert_raise(NameError, bug10744) { C.singleton_method(:foo) }
|
||
|
end;
|
||
|
end
|
||
|
private
|
||
|
def eval_using(mod, s)
|
||