From 99e7c7f623bd44eae88db2373f502cd879bcf7c3 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 18 Aug 2016 16:57:37 -0400 Subject: [PATCH] fix more of the #18017 regression --- base/inference.jl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/base/inference.jl b/base/inference.jl index 01c0e3eb10dbc..2649514a32bd1 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -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