[Bug:trunk] cannot call public'ed method via public_method

e$B1sF#$G$9!#e(B

e$B7Q>5@h$N%/%i%9$Ge(B public e$B$K$7$?%a%=%C%I$re(B public_method
e$B$G<h$j=P$7$Fe(B
e$B8F$S=P$9$He(B undefined private method e$B$H8@$o$l$F$7$^$$$^$9!#e(B

class C
def foo; “FOO”; end
private :foo
end
class D < C
public :foo
end
p D.new.public_method(:foo).call
#=> undefined private method foo' for classD’ (NameError)

e$B$3$l$O8F$S=P$;$k$N$,@52r$H$$$&$3$H$G$$$$$G$7$g$&$+!#e(B

Index: proc.c

— proc.c (revision 25895)
+++ proc.c (working copy)
@@ -894,6 +894,7 @@
struct METHOD *data;
rb_method_entry_t *me, meb;
rb_method_definition_t *def = 0;

  • rb_method_flag_t flag = NOEX_UNDEF;

again:
me = rb_method_entry(klass, id);
@@ -921,8 +922,11 @@
rb_print_undef(klass, id, 0);
}
def = me->def;

  • if (scope && (me->flag & NOEX_MASK) != NOEX_PUBLIC) {
  • rb_print_undef(rclass, def->original_id, (int)(me->flag &
    NOEX_MASK));
  • if (flag == NOEX_UNDEF) {
  • flag = me->flag;
  • if (scope && (flag & NOEX_MASK) != NOEX_PUBLIC) {
  •  rb_print_undef(rclass, def->original_id, (int)(flag & 
    

NOEX_MASK));

  • }
    }
    if (def && def->type == VM_METHOD_TYPE_ZSUPER) {
    klass = RCLASS_SUPER(me->klass);

e$B%A%1%C%He(B #2397 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!<%?%9e(B Assignede$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

This issue was solved with changeset r26256.
Yusuke, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


http://redmine.ruby-lang.org/issues/show/2397