go/types, types2: remove indirection of Named.finite

This field is now guarded by a state bit. The "unknown" state is hence
indicated by absence of that bit.

Change-Id: I9605538f089dd4fd638e5f0f416cd4b8737b6f88
Reviewed-on: https://go-review.googlesource.com/c/go/+/729041
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Mark Freeman
2025-12-10 14:13:00 -05:00
committed by Gopher Robot
parent 5818c9d714
commit 2622d2955b
4 changed files with 6 additions and 6 deletions

View File

@@ -110,7 +110,7 @@ func (check *Checker) finiteSize(t Type) bool {
switch t := Unalias(t).(type) {
case *Named:
if t.stateHas(hasFinite) {
return *t.finite
return t.finite
}
if i, ok := check.objPathIdx[t.obj]; ok {
@@ -129,7 +129,7 @@ func (check *Checker) finiteSize(t Type) bool {
// another call to finiteSize, we have to avoid overwriting t.finite.
// Otherwise, the race detector will be tripped.
if !t.stateHas(hasFinite) {
t.finite = &isFinite
t.finite = isFinite
t.setState(hasFinite)
}

View File

@@ -117,7 +117,7 @@ type Named struct {
fromRHS Type // the declaration RHS this type is derived from
tparams *TypeParamList // type parameters, or nil
underlying Type // underlying type, or nil
finite *bool // whether the type has finite size, or nil
finite bool // whether the type has finite size
// methods declared for this type (not the method set of this type)
// Signatures are type-checked lazily.

View File

@@ -113,7 +113,7 @@ func (check *Checker) finiteSize(t Type) bool {
switch t := Unalias(t).(type) {
case *Named:
if t.stateHas(hasFinite) {
return *t.finite
return t.finite
}
if i, ok := check.objPathIdx[t.obj]; ok {
@@ -132,7 +132,7 @@ func (check *Checker) finiteSize(t Type) bool {
// another call to finiteSize, we have to avoid overwriting t.finite.
// Otherwise, the race detector will be tripped.
if !t.stateHas(hasFinite) {
t.finite = &isFinite
t.finite = isFinite
t.setState(hasFinite)
}

View File

@@ -120,7 +120,7 @@ type Named struct {
fromRHS Type // the declaration RHS this type is derived from
tparams *TypeParamList // type parameters, or nil
underlying Type // underlying type, or nil
finite *bool // whether the type has finite size, or nil
finite bool // whether the type has finite size
// methods declared for this type (not the method set of this type)
// Signatures are type-checked lazily.