diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 19:23:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 19:23:18 +0000 |
commit | 43a123c1ae6613b3efeed291fa552ecd909d3acf (patch) | |
tree | fd92518b7024bc74031f78a1cf9e454b65e73665 /src/go/parser/testdata/tparams.go2 | |
parent | Initial commit. (diff) | |
download | golang-1.20-43a123c1ae6613b3efeed291fa552ecd909d3acf.tar.xz golang-1.20-43a123c1ae6613b3efeed291fa552ecd909d3acf.zip |
Adding upstream version 1.20.14.upstream/1.20.14upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/go/parser/testdata/tparams.go2')
-rw-r--r-- | src/go/parser/testdata/tparams.go2 | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/go/parser/testdata/tparams.go2 b/src/go/parser/testdata/tparams.go2 new file mode 100644 index 0000000..1a9a6c6 --- /dev/null +++ b/src/go/parser/testdata/tparams.go2 @@ -0,0 +1,54 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package p + +type _[a /* ERROR "type parameters must be named" */, b] struct{} +type _[a t, b t, c /* ERROR "type parameters must be named" */ ] struct{} +type _ struct { + t [n]byte + t[a] + t[a,] + t[a, b] + t[a, b,] +} +type _ struct { + t [n, /* ERROR "unexpected comma; expecting ]" */ ]byte +} +type _ interface { + t[a] + t[a,] + m[ /* ERROR "method must have no type parameters" */ _ _, /* ERROR mixed */ _]() + t[a, b] + t[a, b,] +} + +func _[] /* ERROR "empty type parameter list" */ () +func _[a /* ERROR "type parameters must be named" */, b ]() +func _[a t, b t, c /* ERROR "type parameters must be named" */ ]() + +// TODO(rfindley) incorrect error message (see existing TODO in parser) +func f[a b, 0 /* ERROR "expected '\)', found 0" */ ] () + +// issue #49482 +type ( + _[a *[]int] struct{} + _[a *t,] struct{} + _[a *t|[]int] struct{} + _[a *t|t,] struct{} + _[a *t|~t,] struct{} + _[a *struct{}|t] struct{} + _[a *t|struct{}] struct{} + _[a *struct{}|~t] struct{} +) + +// issue #51488 +type ( + _[a *t|t,] struct{} + _[a *t|t, b t] struct{} + _[a *t|t] struct{} + _[a *[]t|t] struct{} + _[a ([]t)] struct{} + _[a ([]t)|t] struct{} +) |