aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/printer_test.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-04-05 19:10:22 -0700
committerRobert Griesemer <gri@golang.org>2021-04-10 19:02:03 +0000
commit4638545d85d7e10e49132ee94ff9a6778db1c893 (patch)
tree2d62f3b4aa751124ca5c6fa2ed0a3516159d04a7 /src/cmd/compile/internal/syntax/printer_test.go
parent1129a60f1c1e64147ca1133857c4571ce9b87a35 (diff)
downloadgo-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/printer_test.go')
-rw-r--r--src/cmd/compile/internal/syntax/printer_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/syntax/printer_test.go b/src/cmd/compile/internal/syntax/printer_test.go
index 4890327595..ec4b1de573 100644
--- a/src/cmd/compile/internal/syntax/printer_test.go
+++ b/src/cmd/compile/internal/syntax/printer_test.go
@@ -149,6 +149,15 @@ var exprTests = [][2]string{
dup("<-chan E"),
dup("chan<- E"),
+ // new interfaces
+ dup("interface{int}"),
+ dup("interface{~int}"),
+ dup("interface{~int}"),
+ dup("interface{int | string}"),
+ dup("interface{~int | ~string; float64; m()}"),
+ dup("interface{type a, b, c; ~int | ~string; float64; m()}"),
+ dup("interface{~T[int, string] | string}"),
+
// non-type expressions
dup("(x)"),
dup("x.f"),