Skip to content

Commit

Permalink
fix more of the JuliaLang#18017 regression
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored and mfasi committed Sep 5, 2016
1 parent c3d06c9 commit 99e7c7f
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 @@ -2262,12 +2262,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 99e7c7f

Please sign in to comment.