replace non-blocking send, receive syntax with select
R=golang-dev, nigeltao, niemeyer, r
CC=golang-dev
https://golang.org/cl/4079053
diff --git a/test/fixedbugs/bug016.go b/test/fixedbugs/bug016.go
index 461bcf8..1cdd8df 100644
--- a/test/fixedbugs/bug016.go
+++ b/test/fixedbugs/bug016.go
@@ -1,4 +1,4 @@
-// ! $G $D/$F.go
+// errchk $G -e $D/$F.go
// 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 i int = 100;
- i = i << -3; // BUG: should not compile (negative shift)
+ var i int = 100
+ i = i << -3 // ERROR "overflows"
}
/*
diff --git a/test/fixedbugs/bug069.go b/test/fixedbugs/bug069.go
index d6796cd..bf73163 100644
--- a/test/fixedbugs/bug069.go
+++ b/test/fixedbugs/bug069.go
@@ -6,15 +6,16 @@
package main
-func main(){
- c := make(chan int);
- ok := false;
- var i int;
-
- i, ok = <-c; // works
- _, _ = i, ok;
-
- ca := new([2]chan int);
- i, ok = <-(ca[0]); // fails: c.go:11: bad shape across assignment - cr=1 cl=2
- _, _ = i, ok;
+func main() {
+ //TODO(rsc): uncomment when this syntax is valid for receive+check closed
+ // c := make(chan int);
+ // ok := false;
+ // var i int;
+ //
+ // i, ok = <-c; // works
+ // _, _ = i, ok;
+ //
+ // ca := new([2]chan int);
+ // i, ok = <-(ca[0]); // fails: c.go:11: bad shape across assignment - cr=1 cl=2
+ // _, _ = i, ok;
}
diff --git a/test/fixedbugs/bug081.go b/test/fixedbugs/bug081.go
index ccb3699..8d3d538 100644
--- a/test/fixedbugs/bug081.go
+++ b/test/fixedbugs/bug081.go
@@ -1,12 +1,12 @@
-// ! $G $D/$F.go
+// errchk $G $D/$F.go
// Copyright 2009 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 main
-
-const x x = 2;
+package main
+
+const x x = 2 // ERROR "loop"
/*
bug081.go:3: first constant must evaluate an expression
diff --git a/test/fixedbugs/bug196.go b/test/fixedbugs/bug196.go
index ea8ab0d..8cb9c999 100644
--- a/test/fixedbugs/bug196.go
+++ b/test/fixedbugs/bug196.go
@@ -13,11 +13,12 @@
func multi() (int, int) { return 1, 2 }
func xxx() {
- var c chan int
- x, ok := <-c
+ //TODO(rsc): uncomment when this syntax is valid for receive+check closed
+ // var c chan int
+ // x, ok := <-c
var m map[int]int
- x, ok = m[1]
+ x, ok := m[1]
var i interface{}
var xx int
diff --git a/test/fixedbugs/bug234.go b/test/fixedbugs/bug234.go
index b806ca6..9affad0 100644
--- a/test/fixedbugs/bug234.go
+++ b/test/fixedbugs/bug234.go
@@ -7,16 +7,17 @@
package main
func main() {
- c := make(chan int, 1)
- c <- 100
- x, ok := <-c
- if x != 100 || !ok {
- println("x=", x, " ok=", ok, " want 100, true")
- panic("fail")
- }
- x, ok = <-c
- if x != 0 || ok {
- println("x=", x, " ok=", ok, " want 0, false")
- panic("fail")
- }
+ //TODO(rsc): uncomment when this syntax is valid for receive+check closed
+ // c := make(chan int, 1)
+ // c <- 100
+ // x, ok := <-c
+ // if x != 100 || !ok {
+ // println("x=", x, " ok=", ok, " want 100, true")
+ // panic("fail")
+ // }
+ // x, ok = <-c
+ // if x != 0 || ok {
+ // println("x=", x, " ok=", ok, " want 0, false")
+ // panic("fail")
+ // }
}
diff --git a/test/fixedbugs/bug242.go b/test/fixedbugs/bug242.go
index 5c21eaa..ad1cef8 100644
--- a/test/fixedbugs/bug242.go
+++ b/test/fixedbugs/bug242.go
@@ -101,10 +101,13 @@
c := make(chan byte, 1)
c <- 'C'
+ //TODO(rsc): uncomment when this syntax is valid for receive+check closed
// 15 16
- *f(), p1 = <-e1(c, 16)
+ // *f(), p1 = <-e1(c, 16)
+ *f(), p1 = <-e1(c, 16), true // delete uncommenting above
// 17 18
- *f(), p2 = <-e1(c, 18)
+ // *f(), p2 = <-e1(c, 18)
+ *f(), p2, _ = 0, false, e1(c, 18) // delete when uncommenting above
a[17] += '0'
if !p1 || p2 {
println("bad chan check", i, p1, p2)