]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: disallow new methods on (aliases to) cgo-generated types
authorRobert Griesemer <gri@golang.org>
Tue, 19 Nov 2024 18:28:45 +0000 (10:28 -0800)
committerGopher Robot <gobot@golang.org>
Wed, 20 Nov 2024 20:05:29 +0000 (20:05 +0000)
commit2ad53d5a1928c6afd368c5ff00d2f6c4425e6bcd
tree891dda097ef150f075cd8e96c44124b45e4bdeae
parent91af7119cd33e59a04d96073bc0f40b588938163
go/types, types2: disallow new methods on (aliases to) cgo-generated types

This makes methods on aliases of cgo-generated types a new compiler error.
That is ok because cgo-behavior is not covered by the G1 compatibility
guarantee.

Background: In 2023 we fixed a gopls issue related to this by actually
enabling methods on cgo-generated types in the first place (#59944).
See the discussion in #60725 and this CL for why we believe it is ok
to make this an error now.

Based on a variation of CL 503596 (by Xie Cui).

Fixes #60725.
For #59944.

Change-Id: I7e9e6e1a76447167483a282b268f5183214027c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/629715
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/compile/internal/types2/issues_test.go
src/cmd/compile/internal/types2/signature.go
src/cmd/go/testdata/script/cgo_badmethod_issue60725.txt [new file with mode: 0644]
src/go/types/issues_test.go
src/go/types/signature.go