// TODO(gri) enable as soon as the unified build supports this.
var excludedForUnifiedBuild = map[string]bool{
"issue47818.go2": true,
+ "issue49705.go2": true,
}
func testFiles(t *testing.T, filenames []string, colDelta uint, manual bool) {
// If x is the lhs of a shift, its final type must be integer.
// We already know from the shift check that it is representable
// as an integer if it is a constant.
- if !isInteger(typ) {
+ if !allInteger(typ) {
check.errorf(x, invalidOp+"shifted operand %s (type %s) must be integer", x, typ)
return
}
--- /dev/null
+// Copyright 2021 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.
+
+package p
+
+import "constraints"
+
+func shl[I constraints.Integer](n int) I {
+ return 1 << n
+}
// TODO(gri) enable as soon as the unified build supports this.
var excludedForUnifiedBuild = map[string]bool{
"issue47818.go2": true,
+ "issue49705.go2": true,
}
func testFiles(t *testing.T, sizes Sizes, filenames []string, srcs [][]byte, manual bool, imp Importer) {
// If x is the lhs of a shift, its final type must be integer.
// We already know from the shift check that it is representable
// as an integer if it is a constant.
- if !isInteger(typ) {
+ if !allInteger(typ) {
check.invalidOp(x, _InvalidShiftOperand, "shifted operand %s (type %s) must be integer", x, typ)
return
}
--- /dev/null
+// Copyright 2021 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.
+
+package p
+
+import "constraints"
+
+func shl[I constraints.Integer](n int) I {
+ return 1 << n
+}