diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-02-14 13:23:51 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-02-14 13:23:51 +0100 |
commit | 758ff64c69e34965f8af5b2d6ffd65e8d7ab2150 (patch) | |
tree | 6d6b34f8c678862fe9b56c945a7b63f68502c245 /test/chan/perm.go | |
parent | 3e45412327a2654a77944249962b3652e6142299 (diff) | |
download | golang-upstream/2011-02-01.1.tar.gz |
Imported Upstream version 2011-02-01.1upstream/2011-02-01.1
Diffstat (limited to 'test/chan/perm.go')
-rw-r--r-- | test/chan/perm.go | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/test/chan/perm.go b/test/chan/perm.go index d08c03519..c725829d1 100644 --- a/test/chan/perm.go +++ b/test/chan/perm.go @@ -9,49 +9,46 @@ package main var ( cr <-chan int cs chan<- int - c chan int + c chan int ) func main() { - cr = c // ok - cs = c // ok - c = cr // ERROR "illegal types|incompatible|cannot" - c = cs // ERROR "illegal types|incompatible|cannot" - cr = cs // ERROR "illegal types|incompatible|cannot" - cs = cr // ERROR "illegal types|incompatible|cannot" - - c <- 0 // ok - ok := c <- 0 // ok - _ = ok - <-c // ok - x, ok := <-c // ok - _, _ = x, ok - - cr <- 0 // ERROR "send" - ok = cr <- 0 // ERROR "send" - _ = ok - <-cr // ok - x, ok = <-cr // ok - _, _ = x, ok - - cs <- 0 // ok - ok = cs <- 0 // ok - _ = ok - <-cs // ERROR "receive" - x, ok = <-cs // ERROR "receive" - _, _ = x, ok + cr = c // ok + cs = c // ok + c = cr // ERROR "illegal types|incompatible|cannot" + c = cs // ERROR "illegal types|incompatible|cannot" + cr = cs // ERROR "illegal types|incompatible|cannot" + cs = cr // ERROR "illegal types|incompatible|cannot" + + c <- 0 // ok + <-c // ok + //TODO(rsc): uncomment when this syntax is valid for receive+check closed + // x, ok := <-c // ok + // _, _ = x, ok + + cr <- 0 // ERROR "send" + <-cr // ok + //TODO(rsc): uncomment when this syntax is valid for receive+check closed + // x, ok = <-cr // ok + // _, _ = x, ok + + cs <- 0 // ok + <-cs // ERROR "receive" + ////TODO(rsc): uncomment when this syntax is valid for receive+check closed + //// x, ok = <-cs // ERROR "receive" + //// _, _ = x, ok select { - case c <- 0: // ok - case x := <-c: // ok + case c <- 0: // ok + case x := <-c: // ok _ = x - case cr <- 0: // ERROR "send" - case x := <-cr: // ok + case cr <- 0: // ERROR "send" + case x := <-cr: // ok _ = x - case cs <- 0: // ok - case x := <-cs: // ERROR "receive" + case cs <- 0: // ok + case x := <-cs: // ERROR "receive" _ = x } } |