Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: "<node DDD>" instead of "..." in errors with [...]T #41247

Closed
ainar-g opened this issue Sep 6, 2020 · 5 comments
Closed

cmd/compile: "<node DDD>" instead of "..." in errors with [...]T #41247

ainar-g opened this issue Sep 6, 2020 · 5 comments

Comments

@ainar-g
Copy link
Contributor

ainar-g commented Sep 6, 2020

What version of Go are you using (go version)?

$ go version
go version go1.15 linux/amd64

Does this issue reproduce with the latest release?

It doesn't reproduce with Go 1.13. It does reproduce with Go 1.14, 1.15, and +721819e7ba. Going to rebuild a more fresh Go, try the tip, and update the issue in a moment.

Update: also reproduces with:

$ go version
go version devel +5cc030aa19 Sun Sep 6 20:23:50 2020 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ainar/.cache/go-build"
GOENV="/home/ainar/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ainar/go/pkg/mod"
GONOPROXY="REDACTED"
GONOSUMDB="REDACTED"
GOOS="linux"
GOPATH="/home/ainar/go"
GOPRIVATE="REDACTED"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/ainar/go/go1.15"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/ainar/go/go1.15/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build723473563=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/rHDhklq4E7D

func f() [2]int {
	return [...]int{2: 0}
}

What did you expect to see?

In Go 1.13:

# command-line-arguments
go/tmp.go:4:17: cannot use [3]int literal (type [3]int) as type [2]int in return argument

What did you see instead?

# command-line-arguments
go/tmp.go:4:17: cannot use [<node DDD>]int literal (type [3]int) as type [2]int in return argument

I saw that on @davecheney's Twitter and tried looking up “node DDD” in existing issues. There didn't seem to be one, so I filed this one.

@cuonglm
Copy link
Member

cuonglm commented Sep 7, 2020

I think this change is intentional, see this CL for mode details.

cc @mdempsky

@josharian
Copy link
Contributor

I’m pretty sure @mdempsky did not intend for to show up in user-facing error messages.

@mdempsky
Copy link
Member

mdempsky commented Sep 7, 2020

Oops. Yeah, that error message is wrong.

It should say either [3]int literal or [...]int literal.

Edit: As Josh suggests, <node FOO> should never appear in user-facing diagnostics. User diagnostics should always be in terms of Go language concepts, but "nodes" are an internal compiler detail.

@gopherbot
Copy link

Change https://golang.org/cl/252942 mentions this issue: cmd/compile: handle ODDD in exprformat

@ainar-g
Copy link
Contributor Author

ainar-g commented Sep 7, 2020

That was quick! Now the message is:

# command-line-arguments
go/tmp.go:4:17: cannot use [...]int literal (type [3]int) as type [2]int in return argument

Thanks, everyone!

@golang golang locked and limited conversation to collaborators Sep 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants