Commit 42c26b73 authored by Russ Cox's avatar Russ Cox

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
parent 62355959
...@@ -644,6 +644,10 @@ reswitch: ...@@ -644,6 +644,10 @@ reswitch:
l = n->left; l = n->left;
if((t = l->type) == T) if((t = l->type) == T)
goto error; goto error;
if(t->etype != TCHAN) {
yyerror("invalid operation: %#N (send to non-chan type %T)", n, t);
goto error;
}
if(!(t->chan & Csend)) { if(!(t->chan & Csend)) {
yyerror("invalid operation: %#N (send to receive-only type %T)", n, t); yyerror("invalid operation: %#N (send to receive-only type %T)", n, t);
goto error; goto error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment