1
0
mirror of https://github.com/golang/go synced 2024-11-24 22:57:57 -07:00

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
This commit is contained in:
Russ Cox 2010-10-07 03:33:42 -04:00
parent 62355959c6
commit 42c26b734c

View File

@ -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;