diff --git a/NEWS b/NEWS index ca563536e717f9..daaacf94d98f92 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ with all sufficient information, see the ChangeLog file or Redmine === Language changes +* Top-level constant look-up is removed. [Feature #11547] + === Core classes updates (outstanding ones only) === Stdlib updates (outstanding ones only) diff --git a/variable.c b/variable.c index 91482e9d0fef38..70a28a670f4175 100644 --- a/variable.c +++ b/variable.c @@ -2273,8 +2273,12 @@ rb_const_search(VALUE klass, ID id, int exclude, int recurse, int visibility) continue; } if (exclude && tmp == rb_cObject && klass != rb_cObject) { +#if 0 rb_warn("toplevel constant %"PRIsVALUE" referenced by %"PRIsVALUE"::%"PRIsVALUE"", QUOTE_ID(id), rb_class_name(klass), QUOTE_ID(id)); +#else + return Qundef; +#endif } return value; }