]> Cypherpunks.ru repositories - gostls13.git/commit
go/types, types2: more concise error messages for cycle errors
authorRobert Griesemer <gri@golang.org>
Wed, 28 Sep 2022 23:44:53 +0000 (16:44 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 29 Sep 2022 14:21:33 +0000 (14:21 +0000)
commite22af33b48447338abf6f788b3eb5b87577f95db
tree15818954e194f701e5f7be6955d8f619f360961d
parentecd112c0d1c90a12d3c87172cf969cdd1f6cbeca
go/types, types2: more concise error messages for cycle errors

If a cycle has length 1, don't enumerate the single cycle entry;
instead just mention "refers to itself". For instance, for an
invalid recursive type T we now report:

invalid recursive type: T refers to itself

instead of:

invalid recursive type T
T refers to
T

Adjust tests to check for the different error messages.

Change-Id: I5bd46f62fac0cf167f0d0c9a55f952981d294ff4
Reviewed-on: https://go-review.googlesource.com/c/go/+/436295
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
19 files changed:
src/cmd/compile/internal/types2/decl.go
src/cmd/compile/internal/types2/initorder.go
src/go/types/decl.go
src/go/types/initorder.go
src/internal/types/testdata/check/cycles0.go
src/internal/types/testdata/check/cycles5.go
src/internal/types/testdata/check/init0.go
src/internal/types/testdata/fixedbugs/issue48819.go
test/fixedbugs/bug195.go
test/fixedbugs/issue23823.go
test/fixedbugs/issue44266.go
test/fixedbugs/issue48301.go
test/fixedbugs/issue7525.go
test/fixedbugs/issue7525b.go
test/fixedbugs/issue7525c.go
test/fixedbugs/issue7525d.go
test/fixedbugs/issue7525e.go
test/fixedbugs/issue8507.go
test/typeparam/issue46461.go