Skip to content

Commit

Permalink
cmd/compile: handle ODDD in exprformat
Browse files Browse the repository at this point in the history
Fixes #41247

Change-Id: Iaa9502cc610e2cc64be5dfd91ba3187f86f87cbd
Reviewed-on: https://go-review.googlesource.com/c/go/+/252942
Run-TryBot: Cuong Manh Le <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Rob Pike <[email protected]>
  • Loading branch information
cuonglm authored and robpike committed Sep 7, 2020
1 parent 0e19aaa commit dc025c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cmd/compile/internal/gc/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1616,7 +1616,8 @@ func (n *Node) exprfmt(s fmt.State, prec int, mode fmtMode) {
}
n1.exprfmt(s, nprec, mode)
}

case ODDD:
mode.Fprintf(s, "...")
default:
mode.Fprintf(s, "<node %v>", n.Op)
}
Expand Down
11 changes: 11 additions & 0 deletions test/fixedbugs/issue41247.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// errorcheck

// Copyright 2020 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.

package p

func f() [2]int {
return [...]int{2: 0} // ERROR "cannot use \[\.\.\.\]int literal \(type \[3\]int\)"
}

0 comments on commit dc025c0

Please sign in to comment.