From 19854cfac4d8f70cee4595366d28b98881137435 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 37ec19e276ddf..5c264eb57dd6f 100644 --- a/src/toplevel.c +++ b/src/toplevel.c @@ -650,8 +650,7 @@ DLLEXPORT jl_value_t *jl_method_def(jl_sym_t *name, jl_value_t **bp, jl_binding_ jl_value_t *gf=NULL; 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) { @@ -662,7 +661,7 @@ DLLEXPORT jl_value_t *jl_method_def(jl_sym_t *name, jl_value_t **bp, jl_binding_ jl_add_constructors((jl_datatype_t*)gf); } 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); } } }