]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: use 2nd operand position for comparison type mismatch errors
authorRobert Griesemer <gri@golang.org>
Tue, 27 Sep 2022 22:23:42 +0000 (15:23 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 27 Sep 2022 23:19:02 +0000 (23:19 +0000)
commitb2137e7dad4fce1f366ad432faed4f78f29ac3fa
tree48b9138ea10254f4daf2570b5389d8a0600fc9b4
parentfa13731a45049eca149bdfd807c35d18ece6a85a
go/types, types2: use 2nd operand position for comparison type mismatch errors

When a comparison is invalid due to mismatched types, we only know
when we see the 2nd operand; so use that operand's position for the
error message. This matches compiler behavior.

For #55326.

Change-Id: I79450756bbdd2b4bb90ed4e960a451be0197b186
Reviewed-on: https://go-review.googlesource.com/c/go/+/435555
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: 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>
src/cmd/compile/internal/types2/expr.go
src/go/types/expr.go
src/internal/types/testdata/check/const0.go
src/internal/types/testdata/check/expr2.go
src/internal/types/testdata/spec/comparisons.go