1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package p 6 7 import "unsafe" 8 9 // Other types of recursion through methods. 10 type R[P any] int 11 12 func (*R[R /* ERROR "must be an identifier" */ [int]]) m0() {} 13 func (R[P]) m1(R[R[P]]) {} 14 func (R[P]) m2(R[*P]) {} 15 func (R[P]) m3([unsafe.Sizeof(new(R[P]))]int) {} 16 func (R[P]) m4([unsafe.Sizeof(new(R[R[P]]))]int) {} 17 18 // Mutual recursion 19 type M[P any] int 20 21 func (R[P]) m5(M[M[P]]) {} 22 func (M[P]) m(R[R[P]]) {} 23