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: spurious compile error when embedding a parameterized type in a struct #44688
Comments
Looks like an error in the type checker. CC @griesemer |
Agreed. This should work. |
Change https://golang.org/cl/298129 mentions this issue: |
https://golang.org/cl/298129 fixes this for |
Change https://golang.org/cl/298349 mentions this issue: |
…ded methods Methods of generic types are instantiated lazily (upon use). Thus, when we encounter a method of such a type, we need to instantiate the method signature with the receiver type arguments. We infer those type arguments from the method receiver. If the method is embedded, we must use the actual embedded receiver type, otherwise the receiver type declared with the method doesn't match up and inference will fail. (Note that there's no type inference in the source code here, it's only the implementation which uses the existing inference mechanism to easily identify the actual type arguments. If the implementation is correct, the inference will always succeed.) Updates #44688. Change-Id: Ie35b62bebaeaf42037f2ca00cf8bd34fec2ddd9c Reviewed-on: https://go-review.googlesource.com/c/go/+/298129 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Note that this has not yet been merged to dev.go2go, or deployed to the go2go playground. I'll update here once this is done. |
This has been merged and deployed. Now that example just runs into #44689, I believe. |
This program (https://go2goplay.golang.org/p/rF1kHzbn4Fc):
causes go2go to emit this spurious-looking error:
dev.go2go version 356c171
The text was updated successfully, but these errors were encountered: