`Conditional` lattice element is semantically broken in the presence of SSAValues
Ooops:
julia> proj1(a, b) = a
proj1 (generic function with 2 methods)
julia> function foo(a)
a = Base.inferencebarrier(a)::Union{Int64, Float64}
if proj1(isa(a, Int64), (a = Base.inferencebarrier(1.0)::Union{Int64, Float64}; true))
return a
end
return 2
end
foo (generic function with 2 methods)
julia> foo(1)
4607182418800017408
Basically, this code doesn't know about SSAValues: https://github.com/JuliaLang/julia/blob/86cba99f6f79bfc6b67e52f0575de211109b638c/base/compiler/typelattice.jl#L749-L757
But it's not clear what a sound way to change that is.
We might need to pass InferenceState to stupdate! or stoverwrite! and call ssa_def_slot from there https://github.com/JuliaLang/julia/blob/84831302997263c70375be070ef0df244fbe5b75/base/compiler/abstractinterpretation.jl#L1443-L1492
Although ssa_def_slot might not be entirely sound either...
That being said, the correct way to replace Conditional would be to implement proper backward abstract interpretation, which would be quite a big work. It might be something we should do, but for now, I'll look for a short-term fix.