]> Cypherpunks.ru repositories - gostls13.git/commit
go/types: preserve untyped constants on the RHS of a shift expression
authorRob Findley <rfindley@google.com>
Mon, 26 Jul 2021 20:33:44 +0000 (16:33 -0400)
committerRobert Findley <rfindley@google.com>
Tue, 27 Jul 2021 00:15:55 +0000 (00:15 +0000)
commit33ff1559702388c57c45f9e6cd032f06e8c3c163
treeea70eb9d690f80f24ed0c4e3d6610216cffde5c7
parent840e583ff340d22a6263a348922283e6d5cd2e31
go/types: preserve untyped constants on the RHS of a shift expression

CL 291316 fixed go/types to verify that untyped shift counts are
representable by uint, but as a side effect also converted their types
to uint.

Rearrange the logic to keep the check for representability, but not
actually convert untyped integer constants. Untyped non-integer
constants are still converted, to preserve the behavior of 1.16. This
behavior for non-integer types is a bug, filed as #47410.

Updates #47410
Fixes #47243

Change-Id: I5eab4aab35b97f932fccdee2d4a18623ee2ccad5
Reviewed-on: https://go-review.googlesource.com/c/go/+/337529
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/api_test.go
src/go/types/check_test.go
src/go/types/expr.go