Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inference: don't widen iskindtype-type to Type within tuple_tfunc #44896

Merged
merged 1 commit into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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 @@ -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