]> Cypherpunks repositories - gostls13.git/commit
go/printer: parenthesize type in <-((<-chan int)(nil))
authorAlan Donovan <adonovan@google.com>
Wed, 4 Oct 2023 14:26:17 +0000 (10:26 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 4 Oct 2023 16:05:21 +0000 (16:05 +0000)
commit0c64ebce7e7007615aba58a19be07372f0febe69
tree55d4f41aed339e6687c6dc9df3e6c68cfc88d4e8
parenta9036396080aa414c032550fc258919636295f0f
go/printer: parenthesize type in <-((<-chan int)(nil))

When printing synthetic syntax (not created by the parser),
the tree for <-((<-chan int)(nil)) without any ParenExpr nodes
was misprinted so that it was parsed back as a receive of
a receive. This changes emits parens around the channel type.

Fixes #63362

Change-Id: I2041ced224f0bca001cee5d37f7a127265d21020
Reviewed-on: https://go-review.googlesource.com/c/go/+/532556
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
src/go/printer/nodes.go
src/go/printer/printer_test.go