From: Russ Cox Date: Thu, 7 Oct 2010 07:33:42 +0000 (-0400) Subject: gc: fix error for 1 <- "foo" X-Git-Tag: weekly.2010-10-13~53 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=42c26b734cf8cf148cf08ae30bf1e05a29bc8851;p=gostls13.git gc: fix error for 1 <- "foo" was x.go:4: invalid operation: 1 <- "foo" (send to receive-only type int) now x.go:4: invalid operation: 1 <- "foo" (send to non-chan type int) R=ken2 CC=golang-dev https://golang.org/cl/2330042 --- diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c index bb4571d9ff..f139ee8210 100644 --- a/src/cmd/gc/typecheck.c +++ b/src/cmd/gc/typecheck.c @@ -644,6 +644,10 @@ reswitch: l = n->left; if((t = l->type) == T) goto error; + if(t->etype != TCHAN) { + yyerror("invalid operation: %#N (send to non-chan type %T)", n, t); + goto error; + } if(!(t->chan & Csend)) { yyerror("invalid operation: %#N (send to receive-only type %T)", n, t); goto error;