Skip to content

Commit

Permalink
follow up #44404, remove duplicated tmeet definition (#44617)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk authored and KristofferC committed Mar 16, 2022
1 parent 484b622 commit 065e41d
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions base/compiler/typelattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -467,45 +467,3 @@ function stupdate1!(state::VarTable, change::StateUpdate)
end
return false
end

# compute typeintersect over the extended inference lattice,
# as precisely as we can,
# where v is in the extended lattice, and t is a Type.
function tmeet(@nospecialize(v), @nospecialize(t))
if isa(v, Const)
if !has_free_typevars(t) && !isa(v.val, t)
return Bottom
end
return v
elseif isa(v, PartialStruct)
has_free_typevars(t) && return v
widev = widenconst(v)
if widev <: t
return v
end
ti = typeintersect(widev, t)
valid_as_lattice(ti) || return Bottom
@assert widev <: Tuple
new_fields = Vector{Any}(undef, length(v.fields))
for i = 1:length(new_fields)
vfi = v.fields[i]
if isvarargtype(vfi)
new_fields[i] = vfi
else
new_fields[i] = tmeet(vfi, widenconst(getfield_tfunc(t, Const(i))))
if new_fields[i] === Bottom
return Bottom
end
end
end
return tuple_tfunc(new_fields)
elseif isa(v, Conditional)
if !(Bool <: t)
return Bottom
end
return v
end
ti = typeintersect(widenconst(v), t)
valid_as_lattice(ti) || return Bottom
return ti
end

0 comments on commit 065e41d

Please sign in to comment.