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

Closed
griesemer opened this issue Dec 4, 2020 · 2 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@griesemer
Copy link
Contributor

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 the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 4, 2020
@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 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.

@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators Apr 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants