From 4638545d85d7e10e49132ee94ff9a6778db1c893 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 5 Apr 2021 19:10:22 -0700 Subject: 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 Run-TryBot: Robert Griesemer TryBot-Result: Go Bot Reviewed-by: Robert Findley --- .../compile/internal/syntax/testdata/interface.go2 | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/cmd/compile/internal/syntax/testdata/interface.go2 (limited to 'src/cmd/compile/internal/syntax/testdata') 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 +} -- cgit v1.3-5-g9baa