]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: qualify named types in error messages with type kind
authorRobert Griesemer <gri@golang.org>
Tue, 22 Oct 2024 18:48:38 +0000 (11:48 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 23 Oct 2024 04:43:01 +0000 (04:43 +0000)
commit7d9802ac5e8e16dddb7e4368172a1c1666fccb77
tree09d94ec357e80bed9e3693dc5ed9f8c8fc8de5a8
parent7ad9a2c65fbffead70474465f5a0f1ad67fe5703
go/types, types2: qualify named types in error messages with type kind

Change the description of an operand x that has a named type of sorts
by providing a description of the type structure (array, struct, slice,
pointer, etc).

For instance, given a (variable) operand x of a struct type T, the
operand is mentioned as (new):

        x (variable of struct type T)

instead of (old):

        x (variable of type T)

This approach is also used when a basic type is renamed, for instance
as in:

        x (value of uint type big.Word)

which makes it clear that big.Word is a uint.

This change is expected to produce more informative error messages.

Fixes #69955.

Change-Id: I544b0698f753a522c3b6e1800a492a94974fbab7
Reviewed-on: https://go-review.googlesource.com/c/go/+/621458
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
15 files changed:
src/cmd/compile/internal/types2/issues_test.go
src/cmd/compile/internal/types2/operand.go
src/go/types/issues_test.go
src/go/types/operand.go
src/internal/types/testdata/check/builtins0.go
src/internal/types/testdata/check/errors.go
src/internal/types/testdata/check/issues0.go
src/internal/types/testdata/fixedbugs/issue49005.go
src/internal/types/testdata/fixedbugs/issue60377.go
src/internal/types/testdata/fixedbugs/issue62157.go
src/internal/types/testdata/fixedbugs/issue69955.go [new file with mode: 0644]
src/internal/types/testdata/spec/range.go
src/internal/types/testdata/spec/range_int.go
test/alias2.go
test/fixedbugs/issue48471.go