Skip to content

Commit

Permalink
fix #9773, better error for trying to add a method to a non- generic …
Browse files Browse the repository at this point in the history
…function

(cherry picked from commit 97381df)
  • Loading branch information
JeffBezanson authored and tkelman committed Feb 6, 2015
1 parent 707f94f commit 5b25589
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
}
}
Expand Down

0 comments on commit 5b25589

Please sign in to comment.