1
0
mirror of https://github.com/golang/go synced 2024-11-25 05:17:57 -07:00
failed to correctly convert from pointer
to interface in a return statement.

moved ANY from a special type in
chan/map to a basic type.

SVN=114350
This commit is contained in:
Ken Thompson 2008-03-31 11:50:47 -07:00
parent c69d54e7cd
commit 5918f80f1a
3 changed files with 10 additions and 14 deletions

View File

@ -967,7 +967,7 @@ cgen_ret(Node *n)
genconv(f->type, arg->type); genconv(f->type, arg->type);
gopcode(PLOAD, PTADDR, a->nname); gopcode(PLOAD, PTADDR, a->nname);
gopcode(PADDO, PTADDR, f->nname); gopcode(PADDO, PTADDR, f->nname);
gopcodet(PSTOREI, arg->type, N); gopcodet(PSTOREI, f->type, N);
} }
arg = listnext(&save); arg = listnext(&save);
f = f->down; f = f->down;

View File

@ -227,7 +227,7 @@ enum
TINTER, TINTER,
TFORW, TFORW,
TFIELD, TFIELD,
TPOLY, TANY,
TSTRING, TSTRING,
NTYPE, NTYPE,

View File

@ -37,8 +37,7 @@
%type <node> simple_stmt osimple_stmt %type <node> simple_stmt osimple_stmt
%type <node> expr uexpr pexpr expr_list oexpr oexpr_list expr_list_r %type <node> expr uexpr pexpr expr_list oexpr oexpr_list expr_list_r
%type <node> name name_name new_name new_name_list_r %type <node> name name_name new_name new_name_list_r
%type <node> type polytype %type <node> type new_type
%type <node> new_type
%type <node> vardcl_list_r vardcl %type <node> vardcl_list_r vardcl
%type <node> constdcl_list_r constdcl %type <node> constdcl_list_r constdcl
%type <node> typedcl_list_r typedcl %type <node> typedcl_list_r typedcl
@ -750,14 +749,14 @@ type:
{ {
$$ = aindex($2, $4); $$ = aindex($2, $4);
} }
| LCHAN chantype polytype | LCHAN chantype type
{ {
$$ = nod(OTYPE, N, N); $$ = nod(OTYPE, N, N);
$$->etype = TCHAN; $$->etype = TCHAN;
$$->type = $3; $$->type = $3;
$$->chan = $2; $$->chan = $2;
} }
| LMAP '[' type ']' polytype | LMAP '[' type ']' type
{ {
$$ = nod(OTYPE, N, N); $$ = nod(OTYPE, N, N);
$$->etype = TMAP; $$->etype = TMAP;
@ -781,6 +780,11 @@ type:
{ {
$$ = dostruct(N, TINTER); $$ = dostruct(N, TINTER);
} }
| LANY
{
$$ = nod(OTYPE, N, N);
$$->etype = TANY;
}
| fntypeh | fntypeh
| '*' type | '*' type
{ {
@ -794,14 +798,6 @@ type:
$$ = forwdcl($2); $$ = forwdcl($2);
} }
polytype:
type
| LANY
{
$$ = nod(OTYPE, N, N);
$$->etype = TPOLY;
}
chantype: chantype:
{ {
$$ = Cboth; $$ = Cboth;