diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2022-06-18 10:29:52 +0200 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2022-06-18 14:49:02 +0200 |
commit | eca31d24d606a73def3674938112dc3c5b79c445 (patch) | |
tree | aa713097baa398f55af41319f6fe1d5c2c583730 /variable.c | |
parent | e7117115399981e1258ca6301e76cc3a24c509e7 (diff) |
[Bug #18813] Warn when autoload has to lookup in parent namespace
This is a verbose mode only warning.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6038
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/variable.c b/variable.c index bf48e711f0..bde8937486 100644 --- a/variable.c +++ b/variable.c @@ -2672,6 +2672,22 @@ autoload_try_load(VALUE _arguments) result = Qfalse; rb_const_remove(arguments->module, arguments->name); + + if (arguments->module == rb_cObject) { + rb_warning( + "Expected %"PRIsVALUE" to define %"PRIsVALUE" but it didn't", + arguments->autoload_data->feature, + ID2SYM(arguments->name) + ); + } + else { + rb_warning( + "Expected %"PRIsVALUE" to define %"PRIsVALUE"::%"PRIsVALUE" but it didn't", + arguments->autoload_data->feature, + arguments->module, + ID2SYM(arguments->name) + ); + } } else { // Otherwise, it was loaded, copy the flags from the autoload constant: |