-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/compile: panic: interface conversion: ir.Node is *ir.Name, not *ir.InstExpr #50264
Comments
I'll investigate this later today or tomorrow. |
Here is a standalone file that appears to create the same compiler crash. package main
type hello struct{}
func main() {
_ = Some(hello{})
res := Applicative2(func(a int, b int) int {
return 0
})
_ = res
}
type NoneType[T any] struct{}
func (r NoneType[T]) Recover() any {
return nil
}
type Func2[A1, A2, R any] func(a1 A1, a2 A2) R
func Some[T any](v T) any {
return NoneType[T]{}.Recover()
}
type Nil struct{}
type ApplicativeFunctor2[H, HT, A1, A2, R any] struct {
h any
}
func Applicative2[A1, A2, R any](fn Func2[A1, A2, R]) ApplicativeFunctor2[Nil, Nil, A1, A2, R] {
return ApplicativeFunctor2[Nil, Nil, A1, A2, R]{Some(Nil{})}
} |
Thanks, @csgura for the issue, and @ianlancetaylor for the simplified example! I understand the issue and have a fix, but will work some more to make sure it is the cleanest fix. |
Change https://golang.org/cl/373754 mentions this issue: |
In the dict info, we need to save the SelectorExpr of a generic method call when making its sub-dictionary entry. The generic method call will eventually be transformed into a function call on the method shape instantiation, so we may not always have the selector info available when we need it to create a dictionary. We use this SelectorExpr as needed if the relevant call node has already been transformed. Similarly, we save the InstExpr of generic function calls, since the InstExpr will be dropped when the function call is transformed to a call to a shape instantiation. We use this InstExpr if the relevant function call has already been transformed. Added an extra generic function Some2 and a call to it from Some that exercises the generic function case. The existing test already tests the method call case. Fixes golang#50264 Change-Id: I2c7c7d79a8e33ca36a5e88e64e913c57500c97f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/373754 Reviewed-by: Keith Randall <khr@golang.org> Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?Gotip playground
What did you do?
https://gotipplay.golang.org/p/cYYbFhofOog
What did you expect to see?
No error
What did you see instead?
If I remove these line, the error goes away
The text was updated successfully, but these errors were encountered: