From 2c60a99f723e779a39664b5f12cb41878fd4a700 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 26 Aug 2021 14:52:32 -0700 Subject: cmd/compile/internal/syntax: make valid type parameter list in presence of errors Make sure the parser fills in names and types for type parameter lists, even in the case of errors. While at it, adjust some of the test functions to accept generic code and report all syntax errors. Added offending source as test for types2. Fixes #47996. Change-Id: I449bcf5e2cb80fa2a24cdd3945f484bfca218a06 Reviewed-on: https://go-review.googlesource.com/c/go/+/345476 Trust: Robert Griesemer Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/types2/testdata/fixedbugs/issue47996.go2 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/cmd/compile/internal/types2/testdata/fixedbugs/issue47996.go2 (limited to 'src/cmd/compile/internal/types2/testdata/fixedbugs/issue47996.go2') diff --git a/src/cmd/compile/internal/types2/testdata/fixedbugs/issue47996.go2 b/src/cmd/compile/internal/types2/testdata/fixedbugs/issue47996.go2 new file mode 100644 index 0000000000..56e90942ab --- /dev/null +++ b/src/cmd/compile/internal/types2/testdata/fixedbugs/issue47996.go2 @@ -0,0 +1,8 @@ +// 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. + +package p + +// don't crash +func T /* ERROR missing */ [P /* ERROR named */ ] m /* ERROR m */ () /* ERROR \) */ { /* ERROR { */ } /* ERROR } */ -- cgit v1.2.3-54-g00ecf