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

Open
griesemer opened this issue Dec 4, 2020 · 1 comment
Open
Assignees
Milestone

Comments

@griesemer
Copy link
Contributor

@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
@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Dec 4, 2020

Correction: go/types seems to be doing it right.

x.go:2:10: expected array length, found '...'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.