]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/types2: permit parentheses around types in interfaces
authorRobert Griesemer <gri@golang.org>
Tue, 19 Apr 2022 00:19:47 +0000 (17:19 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 19 Apr 2022 23:20:11 +0000 (23:20 +0000)
commit86fa2551fb12338405721089d6db1b9d78e4f05e
tree82f0b85c290391aeb9f7c9a7d77cbb4437aeb620
parent3ae414c31e59c9ee210fa3606f36cf0ea36b9906
cmd/compile/internal/types2: permit parentheses around types in interfaces

Before Go 1.18, an embedded type name in an interface could not be
parenthesized. With generalized embedding of types in interfaces,
where one might write ~(chan<- int) for clarity (making clear that
the ~ applies to the entire channel type), it also makes sense to
permit (chan<- int), or (int) for that matter.

Adjust the parser accordingly to match the spec.

(go/types already accepts the notation as specified by the spec.)

Fixes #52391.

Change-Id: Ifdd9a199c5ccc3473b2dac40dbca31d2df10d12b
Reviewed-on: https://go-review.googlesource.com/c/go/+/400797
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/syntax/parser.go
src/cmd/compile/internal/syntax/testdata/issue52391.go [new file with mode: 0644]