Skip to content

Commit a4bf066

Browse files
JeffBezansonjohanmon
authored andcommitted
avoid specializing a closure in the compiler (JuliaLang#40256)
1 parent 6cb7472 commit a4bf066

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

base/compiler/abstractinterpretation.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,9 +1450,9 @@ function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e),
14501450
if length(e.args) == 2 && isconcretetype(t) && !t.mutable
14511451
at = abstract_eval_value(interp, e.args[2], vtypes, sv)
14521452
n = fieldcount(t)
1453-
if isa(at, Const) && (val = at.val; isa(val, Tuple)) && n == length(val) &&
1454-
let t = t, val = val; _all(i->val[i] isa fieldtype(t, i), 1:n); end
1455-
t = Const(ccall(:jl_new_structt, Any, (Any, Any), t, val))
1453+
if isa(at, Const) && isa(at.val, Tuple) && n == length(at.val) &&
1454+
let t = t; _all(i->getfield(at.val, i) isa fieldtype(t, i), 1:n); end
1455+
t = Const(ccall(:jl_new_structt, Any, (Any, Any), t, at.val))
14561456
elseif isa(at, PartialStruct) && at Tuple && n == length(at.fields) &&
14571457
let t = t, at = at; _all(i->at.fields[i] fieldtype(t, i), 1:n); end
14581458
t = PartialStruct(t, at.fields)

0 commit comments

Comments
 (0)