mirror of
https://github.com/golang/go
synced 2024-11-21 22:24:40 -07:00
gc: avoid saying same error 3 times
R=ken2 CC=golang-dev https://golang.org/cl/4316051
This commit is contained in:
parent
46137557c4
commit
6865cc0e8e
@ -136,7 +136,6 @@ convlit1(Node **np, Type *t, int explicit)
|
||||
case CTNIL:
|
||||
switch(et) {
|
||||
default:
|
||||
yyerror("cannot use nil as %T", t);
|
||||
n->type = T;
|
||||
goto bad;
|
||||
|
||||
|
@ -2053,13 +2053,16 @@ Node*
|
||||
assignconv(Node *n, Type *t, char *context)
|
||||
{
|
||||
int op;
|
||||
Node *r;
|
||||
Node *r, *old;
|
||||
char *why;
|
||||
|
||||
if(n == N || n->type == T)
|
||||
return n;
|
||||
|
||||
old = n;
|
||||
old->diag++; // silence errors about n; we'll issue one below
|
||||
defaultlit(&n, t);
|
||||
old->diag--;
|
||||
if(t->etype == TBLANK)
|
||||
return n;
|
||||
|
||||
|
@ -15,7 +15,7 @@ var (
|
||||
_ = sum()
|
||||
_ = sum(1.0, 2.0)
|
||||
_ = sum(1.5) // ERROR "integer"
|
||||
_ = sum("hello") // ERROR "convert|incompatible"
|
||||
_ = sum("hello") // ERROR "string.*as type int|incompatible"
|
||||
_ = sum([]int{1}) // ERROR "slice literal.*as type int|incompatible"
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user