From f38fc6a97a3d28c984f20f8013d6c99d53cc9a51 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 26 Jun 2014 09:48:58 -0700 Subject: [PATCH] go.tools/go/types: add test cases for parenthesized receivers LGTM=adonovan R=adonovan CC=golang-codereviews https://golang.org/cl/101510043 --- go/types/testdata/decls2b.src | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/go/types/testdata/decls2b.src b/go/types/testdata/decls2b.src index e7d9c76d..e7bc3947 100644 --- a/go/types/testdata/decls2b.src +++ b/go/types/testdata/decls2b.src @@ -51,3 +51,15 @@ func (Foo /* ERROR "undeclared" */ ) m() int { return "foo" /* ERROR "cannot con func (Foo /* ERROR "undeclared" */ ) _() {} func (Foo /* ERROR "undeclared" */ ) _(undeclared /* ERROR "undeclared" */ ) {} func (Foo /* ERROR "undeclared" */ ) _() int { return "foo" /* ERROR "cannot convert" */ } + +// Receiver declarations are regular parameter lists; +// receiver types may use parentheses, and the list +// may have a trailing comma. +type T7 struct {} + +func (T7) m1() {} +func ((T7)) m2() {} +func ((*T7)) m3() {} +func (x *(T7),) m4() {} +func (x (*(T7)),) m5() {} +func (x ((*((T7)))),) m6() {}