Skip to content

Commit

Permalink
compiler: Get rid of has_struct_const_info (#46564)
Browse files Browse the repository at this point in the history
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)`.
  • Loading branch information
Keno authored Aug 31, 2022
1 parent a83a0e6 commit 8fa066b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
8 changes: 1 addition & 7 deletions base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1583,12 +1583,6 @@ function apply_type_tfunc(@nospecialize(headtypetype), @nospecialize args...)
end
add_tfunc(apply_type, 1, INT_INF, apply_type_tfunc, 10)

function has_struct_const_info(x)
isa(x, PartialTypeVar) && return true
isa(x, Conditional) && return true
return has_nontrivial_const_info(x)
end

# convert the dispatch tuple type argtype to the real (concrete) type of
# the tuple of those values
function tuple_tfunc(argtypes::Vector{Any})
Expand All @@ -1607,7 +1601,7 @@ function tuple_tfunc(argtypes::Vector{Any})
anyinfo = false
for i in 1:length(argtypes)
x = argtypes[i]
if has_struct_const_info(x)
if has_nontrivial_const_info(x)
anyinfo = true
else
if !isvarargtype(x)
Expand Down
1 change: 1 addition & 0 deletions base/compiler/typeutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ end
function has_nontrivial_const_info(@nospecialize t)
isa(t, PartialStruct) && return true
isa(t, PartialOpaque) && return true
isa(t, PartialTypeVar) && return true
isa(t, Const) || return false
val = t.val
return !isdefined(typeof(val), :instance) && !(isa(val, Type) && hasuniquerep(val))
Expand Down

2 comments on commit 8fa066b

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

Please sign in to comment.