Skip to content

Commit

Permalink
Compiler: fix unsoundness of getfield_tfunc on Tuple Types
Browse files Browse the repository at this point in the history
This was noted in the original review of that PR, but was for some
reason not fixed at that time: #46693 (comment)
  • Loading branch information
vtjnash committed Feb 5, 2025
1 parent 3e08cb1 commit c74f483
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Compiler/src/typeutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,8 @@ function isTypeDataType(@nospecialize t)
isType(t) && return false
# Could be Union{} at runtime
t === Core.TypeofBottom && return false
if t.name === Tuple.name
# If we have a Union parameter, could have been redistributed at runtime,
# e.g. `Tuple{Union{Int, Float64}, Int}` is a DataType, but
# `Union{Tuple{Int, Int}, Tuple{Float64, Int}}` is typeequal to it and
# is not.
return all(isTypeDataType, t.parameters)
end
return true
# Return true if `t` is not covariant
return t.name !== Tuple.name
end

has_extended_info(@nospecialize x) = (!isa(x, Type) && !isvarargtype(x)) || isType(x)
Expand Down

0 comments on commit c74f483

Please sign in to comment.