Skip to content

Commit 303612f

Browse files
committed
throw actual error message for broken generated functions
ref #18605
1 parent c59d2cf commit 303612f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/alloc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,11 @@ JL_DLLEXPORT jl_code_info_t *jl_code_for_staged(jl_method_instance_t *linfo)
529529
}
530530

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

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

0 commit comments

Comments
 (0)