]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: better error msg when type inference fails in a call
authorRobert Griesemer <gri@golang.org>
Tue, 23 Jan 2024 21:21:19 +0000 (13:21 -0800)
committerGopher Robot <gobot@golang.org>
Wed, 24 Jan 2024 21:28:05 +0000 (21:28 +0000)
commite85968670e35fc24987944c56277d80d7884e9cc
tree39d96df09a4769e6624f6b926bc0ecb594baaadf
parent02a092778625a9e9b9eb88c954a4c6e33dc742dc
go/types, types2: better error msg when type inference fails in a call

In Checker.infer, report an error through an (incoming) *error_
so that the error can be reported as desired where infer is called.
Checker.infer is now a pure function.

Fixes #60543.

At call sites of Checker.infer, pass in an *error_ and use it to
report inference errors, together with additional information as
desired.

Fixes #60542.

In go/types, in error_.errorf, pass in a positioner rather than
a token.Pos. Also, introduce noposn, the positioner equivalent
for nopos. Adjust call sites as needed.

Change-Id: I462a7899a77a8bee2a21ba88299df237d74e0672
Reviewed-on: https://go-review.googlesource.com/c/go/+/558035
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/call.go
src/cmd/compile/internal/types2/infer.go
src/go/types/assignments.go
src/go/types/call.go
src/go/types/check.go
src/go/types/errors.go
src/go/types/errors_test.go
src/go/types/infer.go
src/internal/types/testdata/fixedbugs/issue60542.go