]> 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)
committerThan McIntosh <thanm@google.com>
Wed, 27 Mar 2024 19:24:11 +0000 (19:24 +0000)
commitefb7cc4275d20628d670493997c8952c49391f6e
tree7e57d2853f1c6639450a459c2bf0ea9e3a8f9273
parent0bd1a2289d0e37ec5015ce3c05a5873c3a6da3e5
[release-branch.go1.21] go/types, types2: don't do version checks for embedded types of imported interfaces

[This is a re-apply of CL 571075]

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 #66326.
Updates #66064.

Change-Id: I158cf51aa382f85d612ab958ba4b591de1c5fdb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/574736
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.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]