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/go2go: constraint type inference example from proposal causes panic #41216
Comments
@griesemer This code is using constraint type inference, with one type argument specified in the code, and the other type argument inferred. Does the type checker make the inferred type available? Right now I'm seeing that |
Change https://golang.org/cl/253258 mentions this issue: |
@ianlancetaylor Judging from the code ( |
@ianlancetaylor I have a suspicion (to be confirmed): In the example, the expression Also, in Need to investigate some more. |
@ianlancetaylor 1) Constraint type inference did indeed not record the inferred signature if inference was applied to a partially provided (rather than inferred, from the value arguments) type parameter list. 2) Because sometimes we don't have an ast.CallExpr node, e.g. in this example In short, this is a bug in |
… params are provided The existing code didn't record the results of constraint type inference when it was applied to a partial list of (provided) type parameters. Changed Info.Inferred map to accept *ast.CallExpr and *ast.IndexExpr as keys ("call" may be f(x) or f[T]). Updates #41216. Change-Id: I5da7467d01643bf74fb78f6c6728209cbd4006c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/253258 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This should now be fixed in |
Translation tool is fixed on the dev.go2go branch. |
Change https://golang.org/cl/253818 mentions this issue: |
Fixes #41216 Change-Id: Iff109f0a7f047742c5f90d64db201712c04f3259 Reviewed-on: https://go-review.googlesource.com/c/go/+/253818 Reviewed-by: Ian Lance Taylor <iant@golang.org>
I copied and pasted the constraint type inference example from the proposal, and it causes the translator to panic.
https://go2goplay.golang.org/p/JvUmICGpndk
The text was updated successfully, but these errors were encountered: