The source files below (distilled from https://go-review.googlesource.com/c/go/+/360015) are valid and should build, but they're failing when unified IR is enabled.
Notably the issue goes away if either a.F's return type is changed to *T[int] or either package is compiled with inlining disabled (i.e., -l). I suspect the problem is related to instantiating the type later, resulting in the methods not being added for some reason.
$ cat a.go
package a
func F() interface{} { return new(T[int]) }
type T[P any] int
func (x *T[P]) One() int { return x.Two() }
func (x *T[P]) Two() int { return 0 }
$ cat b.go
package b
import "./a"
var _ = a.F()
$ GOEXPERIMENT=unified go tool compile a.go
$ GOEXPERIMENT=unified go tool compile b.go
/tmp/a.go:7:36: a.x.Two undefined (type *a.T[int] has no field or method Two)
The source files below (distilled from https://go-review.googlesource.com/c/go/+/360015) are valid and should build, but they're failing when unified IR is enabled.
Notably the issue goes away if either a.F's return type is changed to
*T[int]or either package is compiled with inlining disabled (i.e.,-l). I suspect the problem is related to instantiating the type later, resulting in the methods not being added for some reason.