diff options
author | Robert Griesemer <gri@golang.org> | 2021-04-05 19:10:22 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-04-10 19:02:03 +0000 |
commit | 4638545d85d7e10e49132ee94ff9a6778db1c893 (patch) | |
tree | 2d62f3b4aa751124ca5c6fa2ed0a3516159d04a7 /src/cmd/compile/internal/syntax/testdata | |
parent | 1129a60f1c1e64147ca1133857c4571ce9b87a35 (diff) | |
download | go-4638545d85d7e10e49132ee94ff9a6778db1c893.tar.gz go-4638545d85d7e10e49132ee94ff9a6778db1c893.zip |
cmd/compile/internal/syntax: accept "~" and "|" interface elements
Type lists continue to be accepted as before.
While at it, print missing filenames in error tests
(which uses an ad-hoc position representation).
Change-Id: I933b3acbc9cf1985ad8f70f6b206e3a1dbd64d1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/307371
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/syntax/testdata')
-rw-r--r-- | src/cmd/compile/internal/syntax/testdata/interface.go2 | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/syntax/testdata/interface.go2 b/src/cmd/compile/internal/syntax/testdata/interface.go2 new file mode 100644 index 0000000000..a817327a43 --- /dev/null +++ b/src/cmd/compile/internal/syntax/testdata/interface.go2 @@ -0,0 +1,36 @@ +// Copyright 2021 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. + +// This file contains test cases for interfaces containing +// constraint elements. +// +// For now, we accept both ordinary type lists and the +// more complex constraint elements. + +package p + +type _ interface { + m() + type int + type int, string + E +} + +type _ interface { + m() + ~int + int | string + int | ~string + ~int | ~string +} + + +type _ interface { + m() + ~int + T[int, string] | string + int | ~T[string, struct{}] + ~int | ~string + type bool, int, float64 +} |