Skip to content

Commit df7334a

Browse files
authored
Improve error when generated function is not pure (#39568)
I hadn't realized that this included generators so it could help others.
1 parent 78c448f commit df7334a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/method.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ JL_DLLEXPORT jl_code_info_t *jl_code_for_staged(jl_method_instance_t *linfo)
477477
ptls->in_pure_callback = 0;
478478
jl_toplevel_eval(def->module, (jl_value_t*)func);
479479
}
480-
jl_error("The function body AST defined by this @generated function is not pure. This likely means it contains a closure or comprehension.");
480+
jl_error("The function body AST defined by this @generated function is not pure. This likely means it contains a closure, a comprehension or a generator.");
481481
}
482482
}
483483

test/core.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5000,7 +5000,8 @@ gVararg(a::fVararg(Int)) = length(a)
50005000
false
50015001
catch e
50025002
(e::ErrorException).msg
5003-
end == "The function body AST defined by this @generated function is not pure. This likely means it contains a closure or comprehension."
5003+
end == "The function body AST defined by this @generated function is not pure. " *
5004+
"This likely means it contains a closure, a comprehension or a generator."
50045005

50055006
let x = 1
50065007
global g18444

0 commit comments

Comments
 (0)