]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/syntax/testdata/tparams.go
cmd/compile/internal/syntax: fix/update various comments
[gostls13.git] / src / cmd / compile / internal / syntax / testdata / tparams.go
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
5 package p
6
7 type t[a, b /* ERROR missing type constraint */ ] struct{}
8 type t[a t, b t, c /* ERROR missing type constraint */ ] struct{}
9 type t struct {
10         t [n]byte
11         t[a]
12         t[a, b]
13 }
14 type t interface {
15         t[a]
16         m /* ERROR method must have no type parameters */ [_ _, /* ERROR mixed */ _]()
17         t[a, b]
18 }
19
20 func f[ /* ERROR empty type parameter list */ ]()
21 func f[a, b /* ERROR missing type constraint */ ]()
22 func f[a t, b t, c /* ERROR missing type constraint */ ]()
23
24 func f[a b,  /* ERROR expected ] */ 0] ()
25
26 // go.dev/issue/49482
27 type (
28         t[a *[]int] struct{}
29         t[a *t,] struct{}
30         t[a *t|[]int] struct{}
31         t[a *t|t,] struct{}
32         t[a *t|~t,] struct{}
33         t[a *struct{}|t] struct{}
34         t[a *t|struct{}] struct{}
35         t[a *struct{}|~t] struct{}
36 )
37
38 // go.dev/issue/51488
39 type (
40         t[a *t|t,] struct{}
41         t[a *t|t, b t] struct{}
42         t[a *t|t] struct{}
43         t[a *[]t|t] struct{}
44         t[a ([]t)] struct{}
45         t[a ([]t)|t] struct{}
46 )