Skip to content
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

go/types, types2: change Checker.infer to return an error (implementation) #60543

Closed
griesemer opened this issue May 31, 2023 · 4 comments
Closed
Assignees
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. 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
Copy link
Contributor

This may make it easier to report the error with context information.
See #60542 for a use case (ability to print calling function with error).

Reminder issue.

@griesemer griesemer added NeedsFix The path to resolution is known, but the work has not been done. early-in-cycle A change that should be done early in the 3 month dev cycle. labels May 31, 2023
@griesemer griesemer added this to the Go1.22 milestone May 31, 2023
@griesemer griesemer self-assigned this May 31, 2023
@gopherbot
Copy link
Contributor

This issue is currently labeled as early-in-cycle for Go 1.22.
That time is now, so a friendly reminder to look at it again.

@griesemer griesemer added the TypeInference Issue is related to generic type inference label Aug 16, 2023
@griesemer
Copy link
Contributor Author

Not urgent. Moving to 1.23.

@griesemer griesemer modified the milestones: Go1.22, Go1.23 Oct 31, 2023
@gopherbot
Copy link
Contributor

This issue is currently labeled as early-in-cycle for Go 1.23.
That time is now, so a friendly reminder to look at it again.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/558035 mentions this issue: go/types, types2: better error msg when type inference fails in a call

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
early-in-cycle A change that should be done early in the 3 month dev cycle. NeedsFix The path to resolution is known, but the work has not been done. TypeInference Issue is related to generic type inference
Projects
None yet
Development

No branches or pull requests

2 participants