-
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: assertion failed in unifier.nify #40038
Comments
Hi @tdakkota, thanks for filing this as well. In the current version of the go2go playground, your example fails on an assertion in Just a quick comment that Crash 24 from #39634 (comment) also crashes on the same assert on the same line 351 of go/types/unify.go. That said, the call stacks leading up to the assert are fairly different between your example vs. Crash 24, so might not be the same core issue. In any event, just wanted to mention this in case it helps with triage. Current playground stacktrace for @tdakkota example
Current playground stacktrace for Crash 24 examplepanic: assertion failed [recovered] panic: assertion failed cc @griesemer |
I tried change Lines 363 to 368 in 9d9619a
to if y, ok := y.(*Named); ok {
// TODO(gri) This is not always correct: two types may have the same names
// in the same package if one of them is nested in a function.
// Extremely unlikely but we need an always correct solution.
if x.obj.pkg == y.obj.pkg && x.obj.name == y.obj.name {
if len(x.targs) != len(y.targs) {
return false
} It's should fix both crash cases. It happens because type checker fails to infer types func main() {
Map(string, int, Optional, Optional)("1", func(s string) int { // here: Optional(T)
return 1
})
} and package main
type C(type P) P
func (r C(P)) m() { y := C.m() } // here: C(P) |
Change https://golang.org/cl/247498 mentions this issue: |
…ters Fixes #40038. Change-Id: I5b095d01fd1e3703561c179c34ddc3b43d7510f6 GitHub-Last-Rev: 3e5067a GitHub-Pull-Request: #40644 Reviewed-on: https://go-review.googlesource.com/c/go/+/247498 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Fixed by https://golang.org/cl/247498. |
Change https://golang.org/cl/248058 mentions this issue: |
…generic type parameters Port of go/types CL https://golang.org/cl/247498. Updates #40038. Change-Id: Iab002132627b689e0113c087b3f4d38c6356c3a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/248058 Reviewed-by: Robert Griesemer <gri@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
n/a
What operating system and processor architecture are you using (
go env
)?What did you do?
https://go2goplay.golang.org/p/JXCEVdUcw-2
What did you expect to see?
Successful compilation or some error.
I don't know should or should't this example compile, but type checker should not panic.
What did you see instead?
Stack trace:
The text was updated successfully, but these errors were encountered: