| 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 |
// The example from the issue. |
| 8 |
type ( |
| 9 |
N[P any] M /* ERROR "invalid recursive type" */ [P] |
| 10 |
M[P any] N[P] |
| 11 |
) |
| 12 |
|
| 13 |
// A slightly more complicated case. |
| 14 |
type ( |
| 15 |
A[P any] B /* ERROR "invalid recursive type" */ [P] |
| 16 |
B[P any] C[P] |
| 17 |
C[P any] A[P] |
| 18 |
) |
| 19 |
|
| 20 |
// Confusing but valid (note that `type T *T` is valid). |
| 21 |
type ( |
| 22 |
N1[P any] *M1[P] |
| 23 |
M1[P any] *N1[P] |
| 24 |
) |