julia
c5e46213 - inference: refine `PartialStruct` with declared method signature (#50590)

Commit
2 years ago
inference: refine `PartialStruct` with declared method signature (#50590) At present, in very rare cases, `PartialStruct` used for const-prop' might have type information that's less strict than type information that can be derived from the method's type signature, e.g.: ```julia Base.@constprop :aggressive function refine_partial_struct((a, b)::Tuple{String,Int}) if iszero(b) println("b=0") # to prevent semi-concrete eval return nothing else return a end end @test Base.return_types((AbstractString,)) do s refine_partial_struct((s, 42)) end |> only === String ``` This commit enhances the accuracy of const-prop' by propagating `tmeet` of `PartialStruct` and the declared type in such situations.
Author
Parents
Loading