You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reported on Discord, this programs fails with a runtime panic with -G=3:
package main
type myifacer[T any] interface{ do(T) error }
type stuff[T any] struct{}
func (s stuff[T]) run() interface{} {
var i myifacer[T]
return i
}
func main() {
stuff[int]{}.run()
}
If only adding a nil check will work, then I think I will just go back to my other implementation https://go-review.googlesource.com/c/go/+/342009/2/src/cmd/compile/internal/noder/stencil.go (which you also thought was fine) that explicitly gets the runtime type from the itab. That approach works with the above test case. I will make it so we share the itabType() code with walk.go, rather than duplicating.
I have a fix for this, at least in part. It's more complicated than either of the above suggestions.
When converting from an interface, we need to use the runtime type from the type word of the interface, not from the dictionary. The dictionary can only provide the interface type for itabs, if the result is a nonempty interface.
Reported on Discord, this programs fails with a runtime panic with -G=3:
It works with go2go and GOEXPERIMENT=unified.
/cc @danscales @randall77
The text was updated successfully, but these errors were encountered: