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
  • Loading branch information
JeffBezanson committed Feb 3, 2015
1 parent c11c985 commit 97381df
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 @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 97381df

Please sign in to comment.