Commit c4416ac0 authored by Russ Cox's avatar Russ Cox

new error messages

x.go:11: illegal types for operand: AS
	*I
	*T
	(*interface vs *struct)

R=r
DELTA=10  (8 added, 0 deleted, 2 changed)
OCL=21457
CL=21602
parent da0a7d7b
...@@ -351,10 +351,10 @@ enum ...@@ -351,10 +351,10 @@ enum
TFUNC, TFUNC,
TARRAY, TARRAY,
T_old_DARRAY, T_old_DARRAY,
TSTRUCT, TSTRUCT, // 23
TCHAN, TCHAN,
TMAP, TMAP,
TINTER, TINTER, // 26
TFORW, TFORW,
TFIELD, TFIELD,
TANY, TANY,
......
...@@ -2140,6 +2140,14 @@ loop: ...@@ -2140,6 +2140,14 @@ loop:
print(" %lT\n", tl); print(" %lT\n", tl);
if(tr != T) if(tr != T)
print(" %lT\n", tr); print(" %lT\n", tr);
// common mistake: *struct and *interface.
if(tl && tr && isptr[tl->etype] && isptr[tr->etype]) {
if(tl->type->etype == TSTRUCT && tr->type->etype == TINTER)
print(" (*struct vs *interface)\n");
else if(tl->type->etype == TINTER && tr->type->etype == TSTRUCT)
print(" (*interface vs *struct)\n");
}
} }
/* /*
......
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