diff --git a/base/inference.jl b/base/inference.jl index 338d74e23ff2ad..a15d124da502e4 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -2097,7 +2097,7 @@ function effect_free(e::ANY, sv, allow_volatile::Bool) if isa(e,Symbol) return allow_volatile end - if isa(e,Number) || isa(e,AbstractString) || isa(e,SSAValue) || + if isa(e,Number) || isa(e,AbstractString) || isa(e,SSAValue) || isa(e,Module) || isa(e,QuoteNode) || isa(e,Type) || isa(e,Tuple) return true end @@ -2117,6 +2117,9 @@ function effect_free(e::ANY, sv, allow_volatile::Bool) if is_known_call(e, arrayref, sv) || is_known_call(e, arraylen, sv) return false elseif is_known_call(e, getfield, sv) + if isType(e.typ) && isleaftype(e.typ) + return true + end # arguments must be immutable to ensure e is affect_free first = true for a in ea