]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: reject anonymous interface cycles
authorMatthew Dempsky <mdempsky@google.com>
Thu, 27 Oct 2022 00:01:24 +0000 (17:01 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 21 Nov 2022 20:15:23 +0000 (20:15 +0000)
commit840b346c5d24a4a8ab5182b6f0711e3c5e65bafc
tree67653b80e3a6e52cb11ef0a45ec342e5055f76fd
parent199d77aff0372daac2db39d7fb2da16269e4ffd4
cmd/compile: reject anonymous interface cycles

This CL changes cmd/compile to reject anonymous interface cycles like:

type I interface { m() interface { I } }

We don't anticipate any users to be affected by this change in
practice. Nonetheless, this CL also adds a `-d=interfacecycles`
compiler flag to suppress the error. And assuming no issue reports
from users, we'll move the check into go/types and types2 instead.

Updates #56103.

Change-Id: I1f1dce2d7aa19fb388312cc020e99cc354afddcb
Reviewed-on: https://go-review.googlesource.com/c/go/+/445598
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/base/debug.go
src/cmd/compile/internal/noder/irgen.go
src/cmd/compile/internal/types2/stdlib_test.go
src/go/types/stdlib_test.go
test/fixedbugs/bug398.go
test/fixedbugs/issue16369.go
test/fixedbugs/issue56103.go [new file with mode: 0644]