Closed arl closed 4 years ago
Slightly smaller reproducer with which the bottom 8 frames before the panic are the same, the rest differs since the code is different:
package main
type (
any interface{}
policy(type K comparable, V any) interface{}
LRU(type K comparable, V any) struct{}
Cache(type K comparable, V any) struct{}
)
func NewCache(type K comparable, V any)(p policy(K, V)) {}
func main() {
lru := LRU(int, string){}
// NewCache(int, string)(&lru) // ok: compiles and run
NewCache(&lru) // nok: 'go tool go2go run' panics
}
Seems to have broken fairly recently.
Thanks. This was triggered by the fix for #39725.
Change https://golang.org/cl/240718 mentions this issue: [dev.go2go] go/types: fix assertion failure, better error message for inference failure
Fixed on dev.go2go.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
It does with the latest commit, at time of writing, of the dev.go2go experimental branch: 6cf6bf162c
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Running the following file:
triggers:
What did you expect to see?
Not sure about the type inference rule here, but I was either expecting a message telling me that the type of
NewCache
can't be inferred or a successful compilation.What did you see instead?
go2go
panicked.Note I think the code is straightforward but I can always try to provide a smaller reproducer