github.com/AndrienkoAleksandr/go@v0.0.19/src/go/parser/testdata/tparams.go2 (about) 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 _[a /* ERROR "type parameters must be named" */, b] struct{} 8 type _[a t, b t, c /* ERROR "type parameters must be named" */ ] struct{} 9 type _ struct { 10 t [n]byte 11 t[a] 12 t[a,] 13 t[a, b] 14 t[a, b,] 15 } 16 type _ struct { 17 t [n, /* ERROR "unexpected comma; expecting ]" */ ]byte 18 } 19 type _ 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 27 func _[] /* ERROR "empty type parameter list" */ () 28 func _[a /* ERROR "type parameters must be named" */, b ]() 29 func _[a t, b t, c /* ERROR "type parameters must be named" */ ]() 30 31 // TODO(rfindley) incorrect error message (see existing TODO in parser) 32 func f[a b, 0 /* ERROR "expected '\)', found 0" */ ] () 33 34 // issue #49482 35 type ( 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 // issue #51488 47 type ( 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 )