]> git.feebdaed.xyz Git - 0xmirror/go.git/commitdiff
go/types, types2: remove indirection of Named.finite
authorMark Freeman <mark@golang.org>
Wed, 10 Dec 2025 19:13:00 +0000 (14:13 -0500)
committerGopher Robot <gobot@golang.org>
Thu, 11 Dec 2025 18:11:13 +0000 (10:11 -0800)
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>

src/cmd/compile/internal/types2/cycles.go
src/cmd/compile/internal/types2/named.go
src/go/types/cycles.go
src/go/types/named.go

index 09229617f0442098e45198e7a14e25f6430064ac..84a05c96474b5666387e2c938c4744b31d4d81f4 100644 (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)
                }
 
index 6b31d6d5df981bd5d94a105bf313fb060b83f600..2922fb55eba270d66730c46a635944ddd78269d7 100644 (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.
index 68868fcc76277e3352a5190f81852ba2df0500e1..9f1e0e8b58879a946e63709c40161bd91d46323f 100644 (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)
                }
 
index 5925a40c00afa09ad797d00022b4ebdc2389b1e7..3b618f403dc629d11e23e36ff08c1388807e418d 100644 (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.