]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/syntax/testdata/issue43527.go
cmd/compile/internal/syntax: better error messages for incorrect type parameter list
[gostls13.git] / src / cmd / compile / internal / syntax / testdata / issue43527.go
1 // Copyright 2021 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 (
8         // 0 and 1-element []-lists are syntactically valid
9         _[A, B /* ERROR missing type constraint */ ] int
10         _[A, /* ERROR missing type parameter name */ interface{}] int
11         _[A, B, C /* ERROR missing type constraint */ ] int
12         _[A B, C /* ERROR missing type constraint */ ] int
13         _[A B, /* ERROR missing type parameter name */ interface{}] int
14         _[A B, /* ERROR missing type parameter name */ interface{}, C D] int
15         _[A B, /* ERROR missing type parameter name */ interface{}, C, D] int
16         _[A B, /* ERROR missing type parameter name */ interface{}, C, interface{}] int
17         _[A B, C interface{}, D, /* ERROR missing type parameter name */ interface{}] int
18 )
19
20 // function type parameters use the same parsing routine - just have a couple of tests
21
22 func _[A, B /* ERROR missing type constraint */ ]() {}
23 func _[A, /* ERROR missing type parameter name */ interface{}]() {}