You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
https://go.dev/play/p/p5A4mFaqogQ creates a synthetic syntax tree representing <-(<-chan int)(nil). The go/format printer renders this as <-<-chan int(nil), which parses to a different tree--a receive of a receive--that doesn't type check because the channel value is int. (If instead we had used <-<-chan chan int(nil), the result would type check but would have a different meaning.) The parser creates a ParenExpr around the type so the problem doesn't show up in gofmt, but only in refactoring tools that create syntax trees programmatically.
I think this is a bug in the printer, and that it should emit parens.
The text was updated successfully, but these errors were encountered:
This change adds parens around the type in T(x) conversions
where T is a receive-only channel type, as previously it
would be misformatted as a receive of a receive.
Updates golang/go#63362
Change-Id: I935b5598d4bc3ea57dd52964e8b02005f5e6ef72
Reviewed-on: https://go-review.googlesource.com/c/tools/+/532576
Reviewed-by: Robert Findley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
https://go.dev/play/p/p5A4mFaqogQ creates a synthetic syntax tree representing
<-(<-chan int)(nil)
. The go/format printer renders this as<-<-chan int(nil)
, which parses to a different tree--a receive of a receive--that doesn't type check because the channel value is int. (If instead we had used<-<-chan chan int(nil)
, the result would type check but would have a different meaning.) The parser creates a ParenExpr around the type so the problem doesn't show up in gofmt, but only in refactoring tools that create syntax trees programmatically.I think this is a bug in the printer, and that it should emit parens.
The text was updated successfully, but these errors were encountered: