aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-09-16 15:09:31 -0700
committerRobert Griesemer <gri@golang.org>2021-09-16 23:13:58 +0000
commite09dcc211a338450d3f680fe39abc13b79ddbb29 (patch)
tree213cabe9149f4d734e9f9a7af0a3160b7302c1ed
parent5402b4376c0c51a31ea9c5ccf16b449a6ab3e79f (diff)
downloadgo-e09dcc211a338450d3f680fe39abc13b79ddbb29.tar.gz
go-e09dcc211a338450d3f680fe39abc13b79ddbb29.zip
go/types, types2: add an additional shift test case
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>
-rw-r--r--src/cmd/compile/internal/types2/api_test.go1
-rw-r--r--src/go/types/api_test.go1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/api_test.go b/src/cmd/compile/internal/types2/api_test.go
index 5a20738631..cd5a61332a 100644
--- a/src/cmd/compile/internal/types2/api_test.go
+++ b/src/cmd/compile/internal/types2/api_test.go
@@ -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 {
diff --git a/src/go/types/api_test.go b/src/go/types/api_test.go
index 4472748685..d4f9bb65c9 100644
--- a/src/go/types/api_test.go
+++ b/src/go/types/api_test.go
@@ -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 {