diff --git a/base/compiler/typelimits.jl b/base/compiler/typelimits.jl index 23045c65cc6bb..3be0965bcd834 100644 --- a/base/compiler/typelimits.jl +++ b/base/compiler/typelimits.jl @@ -377,26 +377,25 @@ function tmerge(@nospecialize(typea), @nospecialize(typeb)) return Bool end # type-lattice for Const and PartialStruct wrappers - if (isa(typea, PartialStruct) || isa(typea, Const)) && - (isa(typeb, PartialStruct) || isa(typeb, Const)) && - widenconst(typea) === widenconst(typeb) + if ((isa(typea, PartialStruct) || isa(typea, Const)) && + (isa(typeb, PartialStruct) || isa(typeb, Const)) && + widenconst(typea) === widenconst(typeb)) - typea_nfields = nfields_tfunc(typea) - typeb_nfields = nfields_tfunc(typeb) - if !isa(typea_nfields, Const) || !isa(typeb_nfields, Const) || typea_nfields.val !== typeb_nfields.val + typea_nfields = nfields_tfunc(typea) + typeb_nfields = nfields_tfunc(typeb) + if !isa(typea_nfields, Const) || !isa(typeb_nfields, Const) || typea_nfields.val !== typeb_nfields.val return widenconst(typea) - end + end - type_nfields = typea_nfields.val::Int - fields = Vector{Any}(undef, type_nfields) - anyconst = false - for i = 1:type_nfields + type_nfields = typea_nfields.val::Int + fields = Vector{Any}(undef, type_nfields) + anyconst = false + for i = 1:type_nfields fields[i] = tmerge(getfield_tfunc(typea, Const(i)), getfield_tfunc(typeb, Const(i))) anyconst |= has_nontrivial_const_info(fields[i]) - end - return anyconst ? PartialStruct(widenconst(typea), fields) : - widenconst(typea) + end + return anyconst ? PartialStruct(widenconst(typea), fields) : widenconst(typea) end if isa(typea, PartialOpaque) && isa(typeb, PartialOpaque) && widenconst(typea) == widenconst(typeb) if !(typea.source === typeb.source &&