From 8dfc5403015684bd4878834d2c42e808fd7cbd2a Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 21 Jan 2016 17:18:02 -0500 Subject: [PATCH] always warn on overwritten methods --- src/gf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gf.c b/src/gf.c index 24fd0d32148df..b790d9c1a71a5 100644 --- a/src/gf.c +++ b/src/gf.c @@ -1229,18 +1229,18 @@ jl_methlist_t *jl_method_list_insert(jl_methlist_t **pml, jl_tupletype_t *type, if (((l->tvars==jl_emptysvec) == (tvars==jl_emptysvec)) && sigs_eq((jl_value_t*)type, (jl_value_t*)l->sig, 1)) { // method overwritten - if (check_amb && l->func->linfo && method->linfo && - (l->func->linfo->module != method->linfo->module)) { + if (check_amb && l->func->linfo && method->linfo) { jl_module_t *newmod = method->linfo->module; + jl_module_t *oldmod = l->func->linfo->module; JL_STREAM *s = JL_STDERR; jl_printf(s, "WARNING: Method definition %s", jl_symbol_name(method->linfo->name)); jl_static_show_func_sig(s, (jl_value_t*)type); - jl_printf(s, " in module %s", - jl_symbol_name(l->func->linfo->module->name)); + jl_printf(s, " in module %s", jl_symbol_name(oldmod->name)); print_func_loc(s, l->func->linfo); - jl_printf(s, " overwritten in module %s", - jl_symbol_name(newmod->name)); + jl_printf(s, " overwritten"); + if (oldmod != newmod) + jl_printf(s, " in module %s", jl_symbol_name(newmod->name)); print_func_loc(s, method->linfo); jl_printf(s, ".\n"); }