]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: guard Named.underlying with Named.mu
authorMark Freeman <mark@golang.org>
Fri, 17 Oct 2025 17:16:34 +0000 (13:16 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 21 Oct 2025 20:51:31 +0000 (13:51 -0700)
commit39fd61ddb0b5987749979bc7e453cf2a575c9392
tree9d6b5095f8a6dca875a0a88c5cb570c81228272c
parent4a0115c886101717dfc6186a3296b69fc4415487
go/types, types2: guard Named.underlying with Named.mu

It appears that CL 695977 introduced a data race on Named.underlying.
This fixes that race by specifying a new namedState called underlying,
which, perhaps unsurprisingly, signals that Named.underlying is populated.

Unfortunately, the underlying namedState is independent of the complete
namedState (unsurprising since methods and the underlying type are not related).

Hence, they cannot be ordered and thus do not fit the current integer-based
state representation. To account for combinations of states, we introduce a
bit set representation for namedState instead. The namedState field is also
renamed to stateMask to reflect this new representation.

Methods that operate on the stateMask are adjusted and exposition is added
throughout.

Fixes #75963

Change-Id: Icfa188ea2fa7916804c06f80668e99176bf4e978
Reviewed-on: https://go-review.googlesource.com/c/go/+/712720
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/types2/named.go
src/go/types/named.go