Skip to content

Commit

Permalink
fix JuliaLang#9773, better error for trying to add a method to a non-…
Browse files Browse the repository at this point in the history
… generic function
  • Loading branch information
JeffBezanson authored and dhoegh committed Feb 4, 2015
1 parent d900738 commit 19854cf
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 19854cf

Please sign in to comment.