| 1 |
// Copyright 2022 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 |
// Example from the issue: |
| 8 |
type A[T any] interface { |
| 9 |
*T |
| 10 |
} |
| 11 |
|
| 12 |
type B[T any] interface { |
| 13 |
B /* ERROR "invalid recursive type" */ [*T] |
| 14 |
} |
| 15 |
|
| 16 |
type C[T any, U B[U]] interface { |
| 17 |
*T |
| 18 |
} |
| 19 |
|
| 20 |
// Simplified reproducer: |
| 21 |
type X[T any] interface { |
| 22 |
X /* ERROR "invalid recursive type" */ [*T] |
| 23 |
} |
| 24 |
|
| 25 |
var _ X[int] |
| 26 |
|
| 27 |
// A related example that doesn't go through interfaces. |
| 28 |
type A2[P any] [10]A2 /* ERROR "invalid recursive type" */ [*P] |
| 29 |
|
| 30 |
var _ A2[int] |