Skip to content

Commit 1787279

Browse files
committed
inference: don't widen DataType/UninAll to Type within tuple_tfunc
Follows up #44725.
1 parent badad9d commit 1787279

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

base/compiler/tfuncs.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,8 @@ function tuple_tfunc(argtypes::Vector{Any})
15581558
else
15591559
params[i] = Type
15601560
end
1561+
elseif x === DataType || x === UnionAll
1562+
params[i] = x
15611563
elseif !isvarargtype(x) && hasintersect(x, Type)
15621564
params[i] = Union{x, Type}
15631565
else

test/compiler/inference.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,8 @@ let tuple_tfunc
15691569
@test Core.Compiler.widenconst(tuple_tfunc(Type{Int})) === Tuple{DataType}
15701570
# https://github.com/JuliaLang/julia/issues/44705
15711571
@test tuple_tfunc(Union{Type{Int32},Type{Int64}}) === Tuple{Type}
1572+
@test tuple_tfunc(DataType) === Tuple{DataType}
1573+
@test tuple_tfunc(UnionAll) === Tuple{UnionAll}
15721574
end
15731575

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

0 commit comments

Comments
 (0)