From: Ken Thompson Date: Mon, 26 Jan 2009 19:34:38 +0000 (-0800) Subject: removed a:b in range syntax X-Git-Tag: weekly.2009-11-06~2295 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7859ae8a2f5f5b48d5961df7c6e84ce7d7c3c46b;p=gostls13.git removed a:b in range syntax added another channel test R=r OCL=23488 CL=23488 --- diff --git a/src/cmd/gc/go.y b/src/cmd/gc/go.y index e8843a97e6..0a7cd0813b 100644 --- a/src/cmd/gc/go.y +++ b/src/cmd/gc/go.y @@ -538,23 +538,11 @@ orange_stmt: $$ = nod(ORANGE, $1, $4); $$->etype = 0; // := flag } -| exprsym3 ':' exprsym3 '=' LRANGE expr - { - $$ = nod(OLIST, $1, $3); - $$ = nod(ORANGE, $$, $6); - $$->etype = 0; - } | exprsym3_list_r LCOLAS LRANGE expr { $$ = nod(ORANGE, $1, $4); $$->etype = 1; } -| exprsym3 ':' exprsym3 LCOLAS LRANGE expr - { - $$ = nod(OLIST, $1, $3); - $$ = nod(ORANGE, $$, $6); - $$->etype = 1; - } for_header: osimple_stmt ';' orange_stmt ';' osimple_stmt diff --git a/test/ken/chan1.go b/test/ken/chan1.go new file mode 100644 index 0000000000..c6d7825b77 --- /dev/null +++ b/test/ken/chan1.go @@ -0,0 +1,56 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// 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 N = 1000; // sent messages +const M = 10; // receiving goroutines +const W = 2; // channel buffering +var h [N]int; // marking of send/recv + +func +r(c chan int, m int) +{ + for { + select { + case r := <- c: + if h[r] != 1 { + panicln("r", + "m=", m, + "r=", r, + "h=", h[r] + ); + } + h[r] = 2; + } + } +} + +func +s(c chan int) +{ + for n:=0; n