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/internal/types2: superfluous error message for [...]byte("foo") #42987

griesemer opened this issue Dec 4, 2020 · 2 comments


Copy link

@griesemer griesemer commented Dec 4, 2020

package p
var _ = [...]byte("foo")

produces the type checker errors:

x.go:2:9: invalid use of [...] array (outside a composite literal)
x.go:2:19: cannot convert "foo" (untyped string constant) to [-1]byte

The 2nd error is not needed and also misleading.

cc: @findleyr

@griesemer griesemer added this to the Go1.17 milestone Dec 4, 2020
@griesemer griesemer self-assigned this Dec 4, 2020
@griesemer griesemer changed the title cmd/compile/internal/types2, go/types: superfluous error message for [...]byte("foo") cmd/compile/internal/types2: superfluous error message for [...]byte("foo") Dec 4, 2020
Copy link
Contributor Author

@griesemer griesemer commented Dec 4, 2020

Correction: go/types seems to be doing it right.
It appears that go/types doesn't report an error at all. Filed separate error: #45651.


Copy link

@gopherbot gopherbot commented Apr 20, 2021

Change mentions this issue: cmd/compile/internal/types2: avoid follow-on errors for invalid [...] array


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants