| 1 |
// -goexperiment=aliastypeparams -gotypesalias=1 |
| 2 |
|
| 3 |
// Copyright 2024 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
package p |
| 8 |
|
| 9 |
type A[P any] func() |
| 10 |
|
| 11 |
// alias signature types |
| 12 |
type B[P any] = func() |
| 13 |
type C[P any] = B[P] |
| 14 |
|
| 15 |
var _ = A /* ERROR "cannot use generic type A without instantiation" */ (nil) |
| 16 |
|
| 17 |
// generic alias signature types must be instantiated before use |
| 18 |
var _ = B /* ERROR "cannot use generic type B without instantiation" */ (nil) |
| 19 |
var _ = C /* ERROR "cannot use generic type C without instantiation" */ (nil) |