diff --git a/base/compiler/typelattice.jl b/base/compiler/typelattice.jl index 5439ec8654f31..c5660c6fa6fd9 100644 --- a/base/compiler/typelattice.jl +++ b/base/compiler/typelattice.jl @@ -417,7 +417,7 @@ function ⊑(lattice::InferenceLattice, @nospecialize(a), @nospecialize(b)) # a and b's unlimited types are equal. isa(a, LimitedAccuracy) || return false # b is limited, so ε smaller - return a.causes ⊆ b.causes + return b.causes ⊆ a.causes end function ⊑(lattice::OptimizerLattice, @nospecialize(a), @nospecialize(b)) diff --git a/base/compiler/typelimits.jl b/base/compiler/typelimits.jl index c09cf4e5d0f91..ed9db007bdbc8 100644 --- a/base/compiler/typelimits.jl +++ b/base/compiler/typelimits.jl @@ -422,8 +422,7 @@ end # Approximated types are lattice equal. Merge causes. if suba && subb - causes = merge_causes(causesa, causesb) - issimplertype(lattice, typeb, typea) && return LimitedAccuracy(typeb, causesb) + return LimitedAccuracy(typeb, merge_causes(causesa, causesb)) elseif suba issimplertype(lattice, typeb, typea) && return LimitedAccuracy(typeb, causesb) causes = causesb @@ -453,6 +452,7 @@ end subb = ⊑(lattice, typeb, typea) end + suba && subb && return LimitedAccuracy(typea, causes) subb && issimplertype(lattice, typea, typeb) && return LimitedAccuracy(typea, causes) return LimitedAccuracy(tmerge(widenlattice(lattice), typea, typeb), causes) end