From e61ac9da2aa54c75344118167654f90cd904005a Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Fri, 23 Sep 2016 17:55:23 -0400 Subject: [PATCH] throw actual error message for broken generated functions --- src/alloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/alloc.c b/src/alloc.c index ee195fd1c508a..af58aa771b711 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -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++) {