]> Cypherpunks repositories - gostls13.git/commitdiff
new error messages
authorRuss Cox <rsc@golang.org>
Fri, 19 Dec 2008 17:03:24 +0000 (09:03 -0800)
committerRuss Cox <rsc@golang.org>
Fri, 19 Dec 2008 17:03:24 +0000 (09:03 -0800)
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

src/cmd/gc/go.h
src/cmd/gc/subr.c

index ed2df2629d4d7adcb833461c28b195d490546dfb..bd1e34662cb4acb5c33b9b1c591e2fbf3c19cfc7 100644 (file)
@@ -351,10 +351,10 @@ enum
        TFUNC,
        TARRAY,
        T_old_DARRAY,
-       TSTRUCT,
+       TSTRUCT,                // 23
        TCHAN,
        TMAP,
-       TINTER,
+       TINTER,                 // 26
        TFORW,
        TFIELD,
        TANY,
index e180258bb84fcff6ae23a4fa4c86899aada4cdea..e1fb97d62ba0fbb7826b6495addad5c9c046aab7 100644 (file)
@@ -2140,6 +2140,14 @@ loop:
                print(" %lT\n", tl);
        if(tr != T)
                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");
+       }
 }
 
 /*