diff options
author | John Hawthorn <[email protected]> | 2024-11-26 16:40:47 -0800 |
---|---|---|
committer | John Hawthorn <[email protected]> | 2024-11-29 20:41:00 -0800 |
commit | f1dda5ed011b79d0d7bd31b09b55b5e19d8abd0c (patch) | |
tree | c041fbb7590bbb9414aab605e00d0c6e570946c8 /vm_method.c | |
parent | a505cd32fb55aec0423c5b57d17ae31c076b44ab (diff) |
Warn when redefining __id__ as well as object_id
[Feature #20912]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12177
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/vm_method.c b/vm_method.c index 9ab035b978..69a533b182 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1072,7 +1072,7 @@ rb_method_entry_make(VALUE klass, ID mid, VALUE defined_class, rb_method_visibil } } /* check mid */ - if (mid == object_id || mid == id__send__) { + if (mid == object_id || mid == id__id__ || mid == id__send__) { if (type != VM_METHOD_TYPE_CFUNC && search_method(klass, mid, 0)) { rb_warn("redefining '%s' may cause serious problems", rb_id2name(mid)); } @@ -1681,7 +1681,7 @@ remove_method(VALUE klass, ID mid) rb_class_modify_check(klass); klass = RCLASS_ORIGIN(klass); - if (mid == object_id || mid == id__send__ || mid == idInitialize) { + if (mid == object_id || mid == id__id__ || mid == id__send__ || mid == idInitialize) { rb_warn("removing '%s' may cause serious problems", rb_id2name(mid)); } @@ -1911,7 +1911,7 @@ rb_undef(VALUE klass, ID id) rb_raise(rb_eTypeError, "no class to undef method"); } rb_class_modify_check(klass); - if (id == object_id || id == id__send__ || id == idInitialize) { + if (id == object_id || id == id__id__ || id == id__send__ || id == idInitialize) { rb_warn("undefining '%s' may cause serious problems", rb_id2name(id)); } |