Skip to content

Commit

Permalink
inference: don't widen DataType/UninAll to Type within `tuple_t…
Browse files Browse the repository at this point in the history
…func` (#44896)

Follows up #44725.

(cherry picked from commit 0deb326)
  • Loading branch information
aviatesk authored and KristofferC committed Jul 4, 2022
1 parent b92e23e commit 50ceb7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,8 @@ function tuple_tfunc(argtypes::Vector{Any})
else
params[i] = Type
end
elseif iskindtype(x)
params[i] = x
elseif !isvarargtype(x) && hasintersect(x, Type)
params[i] = Union{x, Type}
else
Expand Down
2 changes: 2 additions & 0 deletions test/compiler/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,8 @@ let tuple_tfunc
@test Core.Compiler.widenconst(tuple_tfunc(Type{Int})) === Tuple{DataType}
# https://github.com/JuliaLang/julia/issues/44705
@test tuple_tfunc(Union{Type{Int32},Type{Int64}}) === Tuple{Type}
@test tuple_tfunc(DataType) === Tuple{DataType}
@test tuple_tfunc(UnionAll) === Tuple{UnionAll}
end

function f23024(::Type{T}, ::Int) where T
Expand Down

0 comments on commit 50ceb7a

Please sign in to comment.