From 97381df57adf976e08fcd2ccffb01291572ad858 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Tue, 3 Feb 2015 17:02:45 -0500 Subject: [PATCH] fix #9773, better error for trying to add a method to a non- generic function --- src/toplevel.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/toplevel.c b/src/toplevel.c index 2afa2c092e71b..9fda351abcbda 100644 --- a/src/toplevel.c +++ b/src/toplevel.c @@ -664,8 +664,7 @@ DLLEXPORT jl_value_t *jl_method_def(jl_sym_t *name, jl_value_t **bp, jl_value_t JL_GC_PUSH3(&gf, &argtypes, &t); if (bnd && bnd->value != NULL && !bnd->constp) { - jl_errorf("cannot define function %s; it already has a value", - bnd->name->name); + jl_errorf("cannot define function %s; it already has a value", bnd->name->name); } if (*bp != NULL) { @@ -716,7 +715,7 @@ DLLEXPORT jl_value_t *jl_method_def(jl_sym_t *name, jl_value_t **bp, jl_value_t } } if (!jl_is_gf(gf)) { - jl_error("invalid method definition: not a generic function"); + jl_errorf("cannot define function %s; it already has a value", bnd->name->name); } } if (iskw) {