]> Cypherpunks.ru repositories - gostls13.git/commitdiff
go/types, types2: add an additional shift test case
authorRobert Griesemer <gri@golang.org>
Thu, 16 Sep 2021 22:09:31 +0000 (15:09 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 16 Sep 2021 23:13:58 +0000 (23:13 +0000)
The extra test just confirms that the type-checker internally
agrees with the spec with the (otherwise invisible) type given
to an untyped constant in a specific shift expression.

For #48422.

Change-Id: I6d98045f90bd20b0cc0a96a147bec9701039cb07
Reviewed-on: https://go-review.googlesource.com/c/go/+/350410
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/types2/api_test.go
src/go/types/api_test.go

index 5a207386318af1f5b65a3ca406e0542d16074ed0..cd5a61332a780b9b609a373d5f985d6fa1bada63 100644 (file)
@@ -145,6 +145,7 @@ func TestValuesInfo(t *testing.T) {
                {`package f7b; var _            = -1e-2000i`, `-1e-2000i`, `complex128`, `(0 + 0i)`},
 
                {`package g0; const (a = len([iota]int{}); b; c); const _ = c`, `c`, `int`, `2`}, // issue #22341
+               {`package g1; var(j int32; s int; n = 1.0<<s == j)`, `1.0`, `int32`, `1`},        // issue #48422
        }
 
        for _, test := range tests {
index 4472748685e8655b183f9f1e07ec8a60b23e55b9..d4f9bb65c954cb4fca009bc4e55d70acc474c3e3 100644 (file)
@@ -152,6 +152,7 @@ func TestValuesInfo(t *testing.T) {
                {`package f7b; var _            = -1e-2000i`, `-1e-2000i`, `complex128`, `(0 + 0i)`},
 
                {`package g0; const (a = len([iota]int{}); b; c); const _ = c`, `c`, `int`, `2`}, // issue #22341
+               {`package g1; var(j int32; s int; n = 1.0<<s == j)`, `1.0`, `int32`, `1`},        // issue #48422
        }
 
        for _, test := range tests {