Commit 5918f80f authored by Ken Thompson's avatar Ken Thompson

bug31

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
parent c69d54e7
...@@ -967,7 +967,7 @@ cgen_ret(Node *n) ...@@ -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;
......
...@@ -227,7 +227,7 @@ enum ...@@ -227,7 +227,7 @@ enum
TINTER, TINTER,
TFORW, TFORW,
TFIELD, TFIELD,
TPOLY, TANY,
TSTRING, TSTRING,
NTYPE, NTYPE,
......
...@@ -37,8 +37,7 @@ ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -794,14 +798,6 @@ type:
$$ = forwdcl($2); $$ = forwdcl($2);
} }
polytype:
type
| LANY
{
$$ = nod(OTYPE, N, N);
$$->etype = TPOLY;
}
chantype: chantype:
{ {
$$ = Cboth; $$ = Cboth;
......
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