Skip to content

Commit

Permalink
throw actual error message for broken generated functions
Browse files Browse the repository at this point in the history
ref #18605
  • Loading branch information
vtjnash committed Oct 3, 2016
1 parent 39d3699 commit f64fa84
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,11 @@ JL_DLLEXPORT jl_code_info_t *jl_code_for_staged(jl_method_instance_t *linfo)
}

func = (jl_code_info_t*)jl_expand((jl_value_t*)ex);
if (!jl_is_code_info(func))
if (!jl_is_code_info(func)) {
if (jl_is_expr(func) && ((jl_expr_t*)func)->head == error_sym)
jl_interpret_toplevel_expr((jl_value_t*)func);
jl_error("generated function body is not pure. this likely means it contains a closure or comprehension.");
}

jl_array_t *stmts = (jl_array_t*)func->code;
for (i = 0, l = jl_array_len(stmts); i < l; i++) {
Expand Down

0 comments on commit f64fa84

Please sign in to comment.