-
Notifications
You must be signed in to change notification settings - Fork 18k
go/types: spurious diagnostics for untyped shift operands with GoVersion < go1.13 [1.18 backport] #52032
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
Comments
Note that the next minor release is scheduled for next week; if this fix is intended to land for that release it should be prepared soon. |
Change https://go.dev/cl/397680 mentions this issue: |
Approved for backport. This affects users with a go version <1.13 set in go.mod file. |
Closed by merging 9535031 to release-branch.go1.18. |
… shifts on Go < 1.13 CL 337529 introduced upfront type-checking of constant shift operands, to avoid converting their type to uint (per the spec). However, it had an oversight in that the checks intended for non-constant operands still ran after the explicit checking of constant operands. As a result, there are at least two bugs: - When GoVersion is < 1.13, we report spurious errors for untyped constant shift operands. - When the operand is an untyped float constant, we still convert to uint (this was a known bug reported in #47410). Looking at this now, it seems clear that we can avoid both of these bugs by simply not running the additional checks in the case of a constant operand. However, this should be considered with some care, as shifts are notoriously tricky. While cherry-picking, the new test file is updated to use the go1_12 package name, following our convention for specifying language version in the release branch. Fixes #52032 Change-Id: Ia489cc5470b92a8187d3de0423d05b309daf47bb Reviewed-on: https://go-review.googlesource.com/c/go/+/396775 Reviewed-by: Robert Griesemer <gri@golang.org> Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> (cherry picked from commit 8a816d5) Reviewed-on: https://go-review.googlesource.com/c/go/+/397680
@findleyr requested issue #52031 to be considered for backport to the next 1.18 minor release.
The text was updated successfully, but these errors were encountered: