]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: replace pendingType with completion check
authorMark Freeman <mark@golang.org>
Thu, 8 Jan 2026 21:06:45 +0000 (16:06 -0500)
committerGopher Robot <gobot@golang.org>
Tue, 27 Jan 2026 15:52:02 +0000 (07:52 -0800)
commit8ca47fab421e99306afb6f7a0941d85f579ae3c0
treea30fae2a35ad16339fa864e45ebddea7d1960f07
parent2d1f571c6b420757b2a72b9e53d486840a1317f9
go/types, types2: replace pendingType with completion check

This change establishes the invariant that Underlying() cannot observe
a nil RHS for a defined type, unless that type was created by go/types
with an explicitly nil underlying type.

It does so using isComplete, which is a guard to check that a type has
an underlying type. This guard is needed whenever we could produce a
value of a defined type or access some property of a defined type.

Examples include T{}, *x (where x has type *T), T.x, etc. (see CL
734600 for more).

The pendingType mechanism to deeply traverse values of a defined type
is moved to hasVarSize, since this is only truly needed at the site
of a built-in such as unsafe.Sizeof.

This ties cycle detection across value context directly to the syntax,
which seems like the right direction.

Change-Id: Ic47862a2038fb2ba3ae6621e9907265ccbd86ea3
Reviewed-on: https://go-review.googlesource.com/c/go/+/734980
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
19 files changed:
src/cmd/compile/internal/types2/builtins.go
src/cmd/compile/internal/types2/call.go
src/cmd/compile/internal/types2/cycles.go
src/cmd/compile/internal/types2/decl.go
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/index.go
src/cmd/compile/internal/types2/literals.go
src/cmd/compile/internal/types2/named.go
src/go/types/builtins.go
src/go/types/call.go
src/go/types/cycles.go
src/go/types/decl.go
src/go/types/expr.go
src/go/types/index.go
src/go/types/literals.go
src/go/types/named.go
src/internal/types/testdata/fixedbugs/issue52915.go
src/internal/types/testdata/fixedbugs/issue75918.go
src/internal/types/testdata/fixedbugs/issue76478.go