From b738300bbea225fc5a98f6fa26a32942c442b6be Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Thu, 7 Apr 2022 19:06:31 +0900 Subject: [PATCH] inference: don't widen `DataType`/`UninAll` to `Type` within `tuple_tfunc` Follows up #44725. --- base/compiler/tfuncs.jl | 2 ++ test/compiler/inference.jl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/base/compiler/tfuncs.jl b/base/compiler/tfuncs.jl index b7d3b1e282e39..e6625e2d55925 100644 --- a/base/compiler/tfuncs.jl +++ b/base/compiler/tfuncs.jl @@ -1558,6 +1558,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 diff --git a/test/compiler/inference.jl b/test/compiler/inference.jl index d18ef0f64495e..266cb1628f8c6 100644 --- a/test/compiler/inference.jl +++ b/test/compiler/inference.jl @@ -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