Commit 4a2bec97 authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile: fix printing of array types in error messages

Fixes #23094.

Change-Id: I9aa36046488baa5f55cf2099e10cfb39ecd17b06
Reviewed-on: https://go-review.googlesource.com/116256
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 75c1aed3
......@@ -1268,7 +1268,7 @@ func (n *Node) exprfmt(s fmt.State, prec int, mode fmtMode) {
case OTARRAY:
if n.Left != nil {
mode.Fprintf(s, "[]%v", n.Left)
mode.Fprintf(s, "[%v]%v", n.Left, n.Right)
return
}
mode.Fprintf(s, "[]%v", n.Right) // happens before typecheck
......
// errorcheck
// Copyright 2018 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.
// Verify that the array is reported in correct notation.
package p
var a [len(a)]int // ERROR "\[len\(a\)\]int"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment