mirror of
https://github.com/golang/go
synced 2024-11-22 07:24:47 -07:00
bug064
make f(g()) work when g returns multiple args with names different than f expects. func swap(a, b int) (c, d int) { return b, a } swap(swap(1,2)) R=ken OCL=24474 CL=24476
This commit is contained in:
parent
7a3877aa0c
commit
b0009bef20
@ -527,8 +527,6 @@ EXTERN int32 thunk;
|
||||
|
||||
EXTERN int exporting;
|
||||
|
||||
EXTERN int func;
|
||||
|
||||
/*
|
||||
* y.tab.c
|
||||
*/
|
||||
@ -650,6 +648,7 @@ Type* methtype(Type*);
|
||||
int methconv(Type*);
|
||||
Sym* signame(Type*);
|
||||
int eqtype(Type*, Type*, int);
|
||||
int eqtypenoname(Type*, Type*);
|
||||
void argtype(Node*, Type*);
|
||||
int eqargs(Type*, Type*);
|
||||
uint32 typehash(Type*, int);
|
||||
|
@ -1742,6 +1742,25 @@ eqtype(Type *t1, Type *t2, int d)
|
||||
return eqtype(t1->type, t2->type, d+1);
|
||||
}
|
||||
|
||||
int
|
||||
eqtypenoname(Type *t1, Type *t2)
|
||||
{
|
||||
if(t1 == T || t2 == T || t1->etype != TSTRUCT || t2->etype != TSTRUCT)
|
||||
return eqtype(t1, t2, 0);
|
||||
|
||||
|
||||
t1 = t1->type;
|
||||
t2 = t2->type;
|
||||
for(;;) {
|
||||
if(!eqtype(t1, t2, 1))
|
||||
return 0;
|
||||
if(t1 == T)
|
||||
return 1;
|
||||
t1 = t1->down;
|
||||
t2 = t2->down;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
subtype(Type **stp, Type *t, int d)
|
||||
{
|
||||
|
@ -1905,8 +1905,8 @@ ascompatte(int op, Type **nl, Node **nr, int fp)
|
||||
if(l != T && r != N
|
||||
&& structnext(&peekl) != T
|
||||
&& listnext(&peekr) == N
|
||||
&& eqtype(r->type, *nl, 0))
|
||||
return convas(nod(OAS, nodarg(*nl, fp), r));
|
||||
&& eqtypenoname(r->type, *nl))
|
||||
return convas(nod(OAS, nodarg(r->type, fp), r));
|
||||
|
||||
loop:
|
||||
if(l != T && isddd(l->type)) {
|
||||
|
@ -117,12 +117,6 @@ abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
|
||||
=========== chan/nonblock.go
|
||||
PASS
|
||||
|
||||
=========== bugs/bug064.go
|
||||
bugs/bug064.go:15: illegal types for operand: CALL
|
||||
int
|
||||
struct { u int; v int }
|
||||
BUG: compilation should succeed
|
||||
|
||||
=========== bugs/bug085.go
|
||||
bugs/bug085.go:8: P: undefined
|
||||
BUG: fails incorrectly
|
||||
|
Loading…
Reference in New Issue
Block a user