summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2022-06-18 10:29:52 +0200
committerJean Boussier <jean.boussier@gmail.com>2022-06-18 14:49:02 +0200
commiteca31d24d606a73def3674938112dc3c5b79c445 (patch)
treeaa713097baa398f55af41319f6fe1d5c2c583730 /variable.c
parente7117115399981e1258ca6301e76cc3a24c509e7 (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.c16
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: