go/types: test shifts that are disabled in shared test file

CL 425735 consolidated the testdata/check/shifts.go files between
go/types and types2. Because some shifts don't work correctly with
types2, the corresponding tests were disabled in the shared file.
Make sure we keep testing those shifts for go/types by adding a
local test file.

For #52080.
For #54511.

Change-Id: I53507e535bf83b204eaf18fc6c2efefcebf5ebf7
Reviewed-on: https://go-review.googlesource.com/c/go/+/426661
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
Robert Griesemer 2022-08-31 17:40:21 -07:00 committed by Robert Griesemer
parent 157aae6eed
commit e2d2d3a4a6
1 changed files with 27 additions and 0 deletions

27
src/go/types/testdata/local/shifts.go vendored Normal file
View File

@ -0,0 +1,27 @@
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The following shift tests are disabled in the shared
// testdata/check/shifts.go file because they don't work
// correctly with types2 at the moment. See issue #52080.
// Make sure we keep testing them with go/types.
//
// TODO(gri) Once #52080 is fixed, this file can be
// deleted in favor of the re-enabled tests
// in the shared file.
package p
func _() {
var s uint
_ = int32(0x80000000 /* ERROR "overflows int32" */ << s)
// TODO(rfindley) Eliminate the redundant error here.
_ = int32(( /* ERROR "truncated to int32" */ 0x80000000 /* ERROR "truncated to int32" */ + 0i) << s)
_ = int(1 + 0i<<0)
_ = int((1 + 0i) << s)
_ = int(1.0 << s)
_ = int(complex(1, 0) << s)
}