-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: embedded generic type panic: receiver type parameter inference failed #39758
Comments
Thanks for the test case. This is a known internal bug at the moment. Probably won't get to this for a while (1-2 weeks) due to upcoming vacation. |
The below is a probably related but more confusing failure mode. https://go2goplay.golang.org/p/6S_TbYbI-Jo package main
type top(type T, T2) struct {
p *parent(T, T2)
}
type parent(type T, T2) struct {
(child(T, T2))
}
type child(type T, T2) struct {
T2
}
func (d *top(T, T2)) foo() *T {
// panic: internal error: receiver type parameter inference failed
// t, _ := d.p.foo()
// panic: -: unexpected type string character '₇' in "T₇"
t, _ := d.p.child.foo()
return t
}
func (rb *child(T, T2)) foo() (*T, bool) {
return nil, true
}
func main() {
var _ top(int, int)
} It panics with:
|
Here is another program that exhibits a similar issue:
|
@sebastien-rosset Thanks. That example works on the tip of the dev.go2go branch. The playground hasn't caught up yet. |
Probably not super useful, but here is a shorter example (from #39634) that seems to trigger a similar crash as the report above from @rogpeppe :
https://go2goplay.golang.org/p/mXpWPHuuiw0 In the current playground, that example and the example from @rogpeppe both panic in |
This case is unrelated. |
This code, updated to the current syntax (and with unexported identifiers since the compiler cannot handle generic exported types quite yet) type-checks and compiles (e.g., The remaining error ( Closing as a (likely) duplicate of #44345. |
commit 0a03088
The following program panics with "receiver type parameter inference failed".
It looks like it should be OK to me.
https://go2goplay.golang.org/p/LlR3obmF3w8
The full stack trace is:
The text was updated successfully, but these errors were encountered: