go/types, types2: add missing state for assertion

The lazyLoaded and unpacked states are similar. In a concurrent context,
a type can transition lazyLoaded => hasUnder without unpacked being set.
The only difference between lazyLoaded and unpacked is constraint
availability, which isn't needed for the underlying type.

Thus, it's safe to relax this assertion. In fact, the lazyLoaded and
unpacked states almost always appear as lazyLoaded | unpacked, and can
probably be linked into a single state, which CL 744700 aimed to do as a
refactoring.

This change fixes the flakiness while we get the refactoring merged.

Fixes #76494

Change-Id: Ifcee2cca034f8fd4e5e187154ddbe5306fd56f1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/769580
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Mark Freeman 2026-04-21 15:29:11 -04:00 committed by Gopher Robot
parent 6795bb3317
commit 5fb2392a6f
2 changed files with 2 additions and 2 deletions

View file

@ -620,7 +620,7 @@ func (t *Named) String() string { return TypeString(t, nil) }
// any, they were broken (by setting the respective types to invalid) during
// the directCycles check phase.
func (n *Named) resolveUnderlying() {
assert(n.stateHas(unpacked))
assert(n.stateHas(lazyLoaded | unpacked))
var seen map[*Named]bool // for debugging only
if debug {

View file

@ -623,7 +623,7 @@ func (t *Named) String() string { return TypeString(t, nil) }
// any, they were broken (by setting the respective types to invalid) during
// the directCycles check phase.
func (n *Named) resolveUnderlying() {
assert(n.stateHas(unpacked))
assert(n.stateHas(lazyLoaded | unpacked))
var seen map[*Named]bool // for debugging only
if debug {