compiler, runtime: implement shifts by signed amounts
Shifting by signed types is a new language feature in Go 1.13.
This requires a patch to the testsuite:
Index: go.test/test/fixedbugs/bug073.go
===================================================================
--- go.test/test/fixedbugs/bug073.go (revision 274239)
+++ go.test/test/fixedbugs/bug073.go (working copy)
@@ -1,4 +1,4 @@
-// errorcheck
+// compile
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
@@ -7,8 +7,8 @@
package main
func main() {
- var s int = 0;
- var x int = 0;
- x = x << s; // ERROR "illegal|inval|shift"
- x = x >> s; // ERROR "illegal|inval|shift"
+ var s int = 0
+ var x int = 0
+ x = x << s // as of 1.13, these are ok
+ x = x >> s // as of 1.13, these are ok
}
Updates golang/go#19113
Change-Id: Ida01c07dff6c5f1f47559083374688ff3800b272
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/190977
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
3 files changed