1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:04:40 -07:00

gc: better error message for bad type in channel send

# test program
1 package main
2
3 type C chan int
4
5 func F(c C) {
6 	c <- true
7 }

# old error
test.go:6: cannot use true (type bool) as type int in function argument

# new error
test.go:6: cannot use true (type bool) as type int in channel send

R=rsc, ejsherry
CC=golang-dev
https://golang.org/cl/3231042
This commit is contained in:
Anthony Martin 2010-11-22 10:59:51 -05:00 committed by Russ Cox
parent e21aac29ba
commit 1ee4512b98

View File

@ -656,6 +656,7 @@ reswitch:
r = n->right;
if((t = r->type) == T)
goto error;
r = assignconv(r, l->type->type, "send");
// TODO: more aggressive
n->etype = 0;
n->type = T;