]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: use errorCause instead of reportf in comparableType
authorRobert Griesemer <gri@golang.org>
Tue, 4 Mar 2025 16:47:25 +0000 (08:47 -0800)
committerGopher Robot <gobot@golang.org>
Thu, 6 Mar 2025 21:40:58 +0000 (13:40 -0800)
commit5af3658eaa4b6bb9e66fcb4ac426207359628477
tree31cb9f60e6b5f7642e5bb484e526363b7aa49fe5
parent584e631023e1edd49862c20a952608a5518a810e
go/types, types2: use errorCause instead of reportf in comparableType

If the error cause is not further specified (empty string),
avoid allocating a new errorCause. This makes using errorCauses
as boolean signals efficient.

While at it, fix an error message for incomparable arrays:
report the array type rather than its underlying type.

Change-Id: I844b18a76695330ca726932ee760aa89635f6a38
Reviewed-on: https://go-review.googlesource.com/c/go/+/654575
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/instantiate.go
src/cmd/compile/internal/types2/predicates.go
src/cmd/compile/internal/types2/typeset.go
src/cmd/compile/internal/types2/under.go
src/go/types/expr.go
src/go/types/instantiate.go
src/go/types/predicates.go
src/go/types/typeset.go
src/go/types/under.go
src/internal/types/testdata/spec/comparisons.go