New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: failing type inference produces unclear error message #60542
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
TypeInference
Issue is related to generic type inference
Milestone
Comments
griesemer
added
the
NeedsFix
The path to resolution is known, but the work has not been done.
label
May 31, 2023
gopherbot
added
the
compiler/runtime
Issues related to the Go compiler and/or runtime.
label
May 31, 2023
Change https://go.dev/cl/499639 mentions this issue: |
@rsc The CL above gets us halfway there. We can do a whole lot better but probably not for Go 1.21. |
gopherbot
pushed a commit
that referenced
this issue
May 31, 2023
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>
Change https://go.dev/cl/558035 mentions this issue: |
ezz-no
pushed a commit
to ezz-no/go-ezzno
that referenced
this issue
Feb 18, 2024
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 golang#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 golang#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>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
TypeInference
Issue is related to generic type inference
Taken from #60434:
produces:
which is not helpful.
Suggestion by @rsc :
It would be helpful to say what function is being called and what S is, as in:
The text was updated successfully, but these errors were encountered: