From 95dc9c07f3a895f45cfb5dab235cd78f157a9e51 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Wed, 10 Jun 2020 18:53:25 -0700 Subject: Raise RuntimeError for class variable overtaken in nonverbose mode 900e83b50115afda3f79712310e4cb95e4508972 changed from a warning to an error in this case, but the warning was only issued in verbose mode, and therefore the error was only raised in verbose mode. That was not intentional, verbose mode should only change whether warnings are emitted, not other behavior. This issues the RuntimeError in all cases. This change broke a couple tests, as the tests actually issued the warning and therefore now raise an error. This wasn't caught earlier as test_variable suppressed the warning in this case, effectively setting $VERBOSE = false around the code that warned. basictest isn't run in verbose mode and therefore didn't expose the issue previously. Fix these tests. Fixes [Bug #14541] --- variable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'variable.c') diff --git a/variable.c b/variable.c index 0d8a424438..15c4288993 100644 --- a/variable.c +++ b/variable.c @@ -3105,7 +3105,7 @@ cvar_overtaken(VALUE front, VALUE target, ID id) if (front && target != front) { st_data_t did = (st_data_t)id; - if (RTEST(ruby_verbose) && original_module(front) != original_module(target)) { + if (original_module(front) != original_module(target)) { rb_raise(rb_eRuntimeError, "class variable % "PRIsVALUE" of %"PRIsVALUE" is overtaken by %"PRIsVALUE"", ID2SYM(id), rb_class_name(original_module(front)), -- cgit v1.2.3