...
1// Copyright 2020 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
5package p
6
7type _[a, b] /* ERROR "missing type constraint" */ struct{}
8type _[a t, b t, c] /* ERROR "missing type constraint" */ struct{}
9type _ struct {
10 t [n]byte
11 t[a]
12 t[a,]
13 t[a, b]
14 t[a, b,]
15}
16type _ struct {
17 t [n, /* ERROR "unexpected comma; expecting ]" */ ]byte
18}
19type _ interface {
20 t[a]
21 t[a,]
22 m[ /* ERROR "method must have no type parameters" */ _ _, /* ERROR mixed */ _]()
23 t[a, b]
24 t[a, b,]
25}
26
27func _[] /* ERROR "empty type parameter list" */ ()
28func _[a, b ] /* ERROR "missing type constraint" */ ()
29func _[a t, b t, c] /* ERROR "missing type constraint" */ ()
30
31// TODO(rfindley) incorrect error message (see existing TODO in parser)
32func f[a b, 0 /* ERROR "expected '\)', found 0" */ ] ()
33
34// go.dev/issue/49482
35type (
36 _[a *[]int] struct{}
37 _[a *t,] struct{}
38 _[a *t|[]int] struct{}
39 _[a *t|t,] struct{}
40 _[a *t|~t,] struct{}
41 _[a *struct{}|t] struct{}
42 _[a *t|struct{}] struct{}
43 _[a *struct{}|~t] struct{}
44)
45
46// go.dev/issue/51488
47type (
48 _[a *t|t,] struct{}
49 _[a *t|t, b t] struct{}
50 _[a *t|t] struct{}
51 _[a *[]t|t] struct{}
52 _[a ([]t)] struct{}
53 _[a ([]t)|t] struct{}
54)
55
56// go.dev/issue/60812
57type (
58 _ [t]struct{}
59 _ [[]t]struct{}
60 _ [[t]t]struct{}
61 _ [t /* ERROR "missing type parameter name or invalid array length" */ [t]]struct{}
62 _ [t t[t], t /* ERROR "missing type parameter name" */ [t]]struct{}
63 _ [t /* ERROR "missing type parameter name" */ [t], t t[t]]struct{}
64 _ [t /* ERROR "missing type parameter name" */ [t], t[t]]struct{} // report only first error
65)
View as plain text