]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: better error message for some inference failures
authorRobert Griesemer <gri@golang.org>
Wed, 31 May 2023 22:15:13 +0000 (15:15 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 31 May 2023 22:48:09 +0000 (22:48 +0000)
commit1079a5c08a8682c35c43cd75737ed94b5999d9ed
tree22321a7a796e668440da16791e517252b02b3a14
parentfdd9911d1a97066752f0d889db8713bae0449a74
go/types, types2: better error message for some inference failures

For a unification failure involving a constraint, rather than just
reporting (for instance)

        S does not match []E

now report the inferred type for the type parameter, use spec
terminology when referring to the constraint, and print the
constraint in full:

        S (type func()) does not satisfy ~[]E

There's more we can do, but this is better than what we had.

For #60542.

Change-Id: I033369fa0dfc475f0ec0da0582e8cbefb109f3cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/499639
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/infer.go
src/go/types/infer.go
src/internal/types/testdata/examples/inference.go
src/internal/types/testdata/fixedbugs/issue45985.go
src/internal/types/testdata/fixedbugs/issue49112.go
src/internal/types/testdata/fixedbugs/issue51472.go
src/internal/types/testdata/fixedbugs/issue60542.go [new file with mode: 0644]