mirror of
https://github.com/golang/go
synced 2024-11-12 08:40:21 -07:00
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
This commit is contained in:
parent
da0a7d7b8f
commit
c4416ac06b
@ -351,10 +351,10 @@ enum
|
||||
TFUNC,
|
||||
TARRAY,
|
||||
T_old_DARRAY,
|
||||
TSTRUCT,
|
||||
TSTRUCT, // 23
|
||||
TCHAN,
|
||||
TMAP,
|
||||
TINTER,
|
||||
TINTER, // 26
|
||||
TFORW,
|
||||
TFIELD,
|
||||
TANY,
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user