Skip to content

Commit

Permalink
fix more of the #18017 regression
Browse files Browse the repository at this point in the history
(cherry picked from commit b32fcc9)
ref #18126
  • Loading branch information
JeffBezanson authored and tkelman committed Aug 21, 2016
1 parent 55a5b12 commit 38bec84
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2261,12 +2261,15 @@ function effect_free(e::ANY, linfo::LambdaInfo, allow_volatile::Bool)
if !allow_volatile
if is_known_call(e, arrayref, linfo) || is_known_call(e, arraylen, linfo)
return false
elseif is_known_call(e, getfield, linfo) && !isa(exprtype(e,linfo), Const)
# first argument must be immutable to ensure e is affect_free
a = ea[2]
typ = widenconst(exprtype(a, linfo))
if !isa(typ, DataType) || typ.mutable || typ.abstract
return false
elseif is_known_call(e, getfield, linfo)
et = exprtype(e,linfo)
if !isa(et,Const) && !(isType(et) && isleaftype(et))
# first argument must be immutable to ensure e is affect_free
a = ea[2]
typ = widenconst(exprtype(a, linfo))
if !isa(typ, DataType) || typ.mutable || typ.abstract
return false
end
end
end
end
Expand Down

0 comments on commit 38bec84

Please sign in to comment.