We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
func _() { var x int var f func() []int _ = f[x] }
https://go.dev/play/p/ev4lDI7nxQ-
Outputs:
./prog.go:6:6: x declared and not used ./prog.go:8:7: invalid operation: cannot index f (variable of type func() []int)
But x is used. On go1.17 there is just one error: ./run.go:10:15: invalid operation: f[x] (type func() []int does not support indexing).
x
go1.17
./run.go:10:15: invalid operation: f[x] (type func() []int does not support indexing)
CC @griesemer
The text was updated successfully, but these errors were encountered:
Change https://go.dev/cl/504877 mentions this issue: go/types, types2: avoid spurious "declared and not used" error
go/types, types2: avoid spurious "declared and not used" error
Sorry, something went wrong.
b1f1fb2
65555e8
Fixes golang#60906. Change-Id: Iba117b36041f72a54ce82cc914f8fa3b07a6fb2e Reviewed-on: https://go-review.googlesource.com/c/go/+/504877 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
No branches or pull requests
https://go.dev/play/p/ev4lDI7nxQ-
Outputs:
But
x
is used. Ongo1.17
there is just one error:./run.go:10:15: invalid operation: f[x] (type func() []int does not support indexing)
.CC @griesemer
The text was updated successfully, but these errors were encountered: