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`

Follows up #44725.
  • Loading branch information
aviatesk committed Apr 10, 2022
1 parent 992b261 commit fb36bc4
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 @@ -1558,6 +1558,8 @@ function tuple_tfunc(argtypes::Vector{Any})
else
params[i] = Type
end
elseif x === DataType || x === UnionAll
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 @@ -1569,6 +1569,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 fb36bc4

Please sign in to comment.