[!go1.18] skip

# TODO: catch unusedGeneric.
unparam .

-- stdout.golden --
-- go.mod --
module testdata.tld/foo

go 1.18
-- foo.go --
package foo

var DoWork func()

func GenericFunc[GenericParamA, B any](x GenericParamA, y B) {}

type GenericVector[GenericParamT any] []GenericParamT

type GenericGraph[T any] struct {
	Content T
	Edges []GenericGraph[T]
}

type PredeclaredSignedInteger interface {
	int | int8 | int16 | int32 | int64
}

type StringableSignedInteger interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64

	String() string
}

type CombineEmbeds interface {
	string | int

	interface { EmbeddedMethod() }
	RegularMethod()
}

type Tuple[T1 any, T2 any] struct {
	left  T1
	right T2
}

func (t Tuple[T1, T2]) Left() T1  { return t.left }
func (t Tuple[T1, T2]) Right() T2 { return t.right }

func (t Tuple[T1, T2]) unusedGeneric(t1 T1, t2 T2) T2 {
	DoWork()
	return t2
}

// otherwise Tuple isn't reachable.
var Sink interface{} = new(Tuple[int, string])

// The different number of type parameters result in different receiver AST
// nodes on methods: IndexExpr and IndexListExpr.
type GenericType1[T1 any] []T1
type GenericType2[T1 any, T2 any] struct {
	t1 T1
	t2 T2
}

-- foo_main.go --
//+build !other

package foo

func (g *GenericType1[T1]) multImplsMethodGeneric(f1 T1) {
	DoWork()
}

func (g GenericType2[T1, T2]) multImplsMethodGeneric(f1 T1, f2 T2) T2 {
	DoWork()
	return f2
}
-- foo_other.go --
//+build other

package foo

func (g *GenericType1[T1]) multImplsMethodGeneric(f1 T1) {
	DoWork()
}

func (g GenericType2[T1, T2]) multImplsMethodGeneric(f1 T1, f2 T2) T2 {
	DoWork()
	return f2
}
