]> Cypherpunks.ru repositories - gostls13.git/commit
[release-branch.go1.21] go/types, types2: don't do version checks for embedded types...
authorRobert Griesemer <gri@golang.org>
Tue, 12 Mar 2024 16:31:06 +0000 (09:31 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 12 Mar 2024 20:30:58 +0000 (20:30 +0000)
commit6d229889d864c9f7a02fb107952832f508f9b40d
treed2ab659907e9d88ec0bd2d614236044f64650996
parent63992defa823418e8ad91a39777cd671cff89894
[release-branch.go1.21] go/types, types2: don't do version checks for embedded types of imported interfaces

Imported interfaces don't have position information for embedded types.
When computing the type set of such interfaces, doing a version check
may fail because it will rely on the Go version of the current package.

We must not do a version check for features of types from imported
packages - those types have already been typechecked and are "correct".
The version check code does look at packages to avoid such incorrect
version checks, but we don't have the package information available
in an interface type (divorced from its object).

Instead, for now rely on the fact that imported interfaces don't have
position information for embedded types: if the position is unknown,
don't do a version check.

We may want to assert that positions are known in all other cases,
but since this is an older release, don't add such additional changes
to avoid introducing other bugs.

Fixes #66064.

Change-Id: I773d57e5410c3d4a911ab3e018b3233c2972b3c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/571075
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@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/typeset.go
src/go/types/typeset.go
src/internal/types/testdata/fixedbugs/issue66064.go [new file with mode: 0644]