Closed
Description
This test case sends go/types into an infinite recursion: https://go2goplay.golang.org/p/fpWup_pjUzi
type T[U interface{ M() T }] int
type X int
func (X) M() T[X] { return 0 }
Two questions:
-
Are recursive type parameters like this supposed to work? If so, this has implications on extending the go/types API and export data format to support type parameters (e.g., see also proposal: go/types: lazy resolution of imported objects #46449 (comment)).
-
Also if so, shouldn't
interface{ M() T }
actually beinterface{ M() T[U] }
? However, go/types explicitly rejects the latter.