Skip to content

Commit 8fa066b

Browse files
authored
compiler: Get rid of has_struct_const_info (#46564)
This was introduced by me in #39684, but the commit message has no discussion as to why `has_struct_const_info` and `has_nontrivial_const_info` are not the same function. Moreover, I don't think the `isa(x, Conditional)` branch ever did anything because even at the time of the commit, `tuple_tfunc` applied `widenconditional` to all incoming argtypes. That leaves `PartialTypeVar`, which seems reasonable to just include in the definition of `has_nontrivial_const_info`, so that we may be consistent between `tuple_tfunc` and `Expr(:new)`.
1 parent a83a0e6 commit 8fa066b

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

base/compiler/tfuncs.jl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,12 +1583,6 @@ function apply_type_tfunc(@nospecialize(headtypetype), @nospecialize args...)
15831583
end
15841584
add_tfunc(apply_type, 1, INT_INF, apply_type_tfunc, 10)
15851585

1586-
function has_struct_const_info(x)
1587-
isa(x, PartialTypeVar) && return true
1588-
isa(x, Conditional) && return true
1589-
return has_nontrivial_const_info(x)
1590-
end
1591-
15921586
# convert the dispatch tuple type argtype to the real (concrete) type of
15931587
# the tuple of those values
15941588
function tuple_tfunc(argtypes::Vector{Any})
@@ -1607,7 +1601,7 @@ function tuple_tfunc(argtypes::Vector{Any})
16071601
anyinfo = false
16081602
for i in 1:length(argtypes)
16091603
x = argtypes[i]
1610-
if has_struct_const_info(x)
1604+
if has_nontrivial_const_info(x)
16111605
anyinfo = true
16121606
else
16131607
if !isvarargtype(x)

base/compiler/typeutils.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ end
2626
function has_nontrivial_const_info(@nospecialize t)
2727
isa(t, PartialStruct) && return true
2828
isa(t, PartialOpaque) && return true
29+
isa(t, PartialTypeVar) && return true
2930
isa(t, Const) || return false
3031
val = t.val
3132
return !isdefined(typeof(val), :instance) && !(isa(val, Type) && hasuniquerep(val))

0 commit comments

Comments
 (0)