From 8192aff942a9b4385188a78404a47502683c354f Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Fri, 6 Jan 2017 07:22:04 -0500 Subject: [PATCH] don't warn about redefining methods in Main (closes #18725) (#19888) --- src/gf.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/gf.c b/src/gf.c index 60d98366878f6..ac4675bbaf067 100644 --- a/src/gf.c +++ b/src/gf.c @@ -1181,16 +1181,18 @@ static void method_overwrite(jl_typemap_entry_t *newentry, jl_method_t *oldvalue jl_method_t *method = (jl_method_t*)newentry->func.method; jl_module_t *newmod = method->module; jl_module_t *oldmod = oldvalue->module; - JL_STREAM *s = JL_STDERR; - jl_printf(s, "WARNING: Method definition "); - jl_static_show_func_sig(s, (jl_value_t*)newentry->sig); - jl_printf(s, " in module %s", jl_symbol_name(oldmod->name)); - print_func_loc(s, oldvalue); - jl_printf(s, " overwritten"); - if (oldmod != newmod) - jl_printf(s, " in module %s", jl_symbol_name(newmod->name)); - print_func_loc(s, method); - jl_printf(s, ".\n"); + if (newmod != jl_main_module || oldmod != jl_main_module) { + JL_STREAM *s = JL_STDERR; + jl_printf(s, "WARNING: Method definition "); + jl_static_show_func_sig(s, (jl_value_t*)newentry->sig); + jl_printf(s, " in module %s", jl_symbol_name(oldmod->name)); + print_func_loc(s, oldvalue); + jl_printf(s, " overwritten"); + if (oldmod != newmod) + jl_printf(s, " in module %s", jl_symbol_name(newmod->name)); + print_func_loc(s, method); + jl_printf(s, ".\n"); + } } static void update_max_args(jl_methtable_t *mt, jl_tupletype_t *type)