cmd/compile: fixed error message about println says print

When one of the arguments to println has an invalid type, the error
message incorrectly mentions print instead of println. This CL fixes
the error message.

Fixed #79258

Change-Id: I9f3c1b08263a834a2068b96b57a4fd7a92af9ffe
Reviewed-on: https://go-review.googlesource.com/c/go/+/775800
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Youlin Feng 2026-05-08 22:12:08 +08:00 committed by Gopher Robot
parent 5b106947d1
commit f552547748
2 changed files with 12 additions and 1 deletions

View file

@ -744,7 +744,7 @@ func walkPrint(nn *ir.CallExpr, init *ir.Nodes) ir.Node {
}
}
default:
badtype(ir.OPRINT, n.Type(), nil)
badtype(nn.Op(), n.Type(), nil)
continue
}

View file

@ -0,0 +1,11 @@
// errorcheck -std
// Copyright 2026 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 main
func main() {
println([1]byte{}) // ERROR "illegal types for operand: println"
}