]> Cypherpunks repositories - gostls13.git/commitdiff
bug31
authorKen Thompson <ken@golang.org>
Mon, 31 Mar 2008 18:50:47 +0000 (11:50 -0700)
committerKen Thompson <ken@golang.org>
Mon, 31 Mar 2008 18:50:47 +0000 (11:50 -0700)
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

src/c/gen.c
src/c/go.h
src/c/go.y

index 57dbd84fd48015ecca97d1dfda4c1b97c8d54a70..0644d17651fc0e5cd536a80831a100c18666273d 100644 (file)
@@ -967,7 +967,7 @@ cgen_ret(Node *n)
                        genconv(f->type, arg->type);
                        gopcode(PLOAD, PTADDR, a->nname);
                        gopcode(PADDO, PTADDR, f->nname);
-                       gopcodet(PSTOREI, arg->type, N);
+                       gopcodet(PSTOREI, f->type, N);
                }
                arg = listnext(&save);
                f = f->down;
index a0fd35e1aa8e769e55edccff0b2f4e8157aaf114..73cc8da1c909fe63945eb4d5767401738e725f20 100644 (file)
@@ -227,7 +227,7 @@ enum
        TINTER,
        TFORW,
        TFIELD,
-       TPOLY,
+       TANY,
        TSTRING,
 
        NTYPE,
index eb122474f2ea4b3bbd301d3faf50bb27641d6120..9d4433cf9d7a91afb0e48f754060b68a2b76312b 100644 (file)
@@ -37,8 +37,7 @@
 %type  <node>          simple_stmt osimple_stmt
 %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>          type polytype
-%type  <node>          new_type
+%type  <node>          type new_type
 %type  <node>          vardcl_list_r vardcl
 %type  <node>          constdcl_list_r constdcl
 %type  <node>          typedcl_list_r typedcl
@@ -750,14 +749,14 @@ type:
        {
                $$ = aindex($2, $4);
        }
-|      LCHAN chantype polytype
+|      LCHAN chantype type
        {
                $$ = nod(OTYPE, N, N);
                $$->etype = TCHAN;
                $$->type = $3;
                $$->chan = $2;
        }
-|      LMAP '[' type ']' polytype
+|      LMAP '[' type ']' type
        {
                $$ = nod(OTYPE, N, N);
                $$->etype = TMAP;
@@ -781,6 +780,11 @@ type:
        {
                $$ = dostruct(N, TINTER);
        }
+|      LANY
+       {
+               $$ = nod(OTYPE, N, N);
+               $$->etype = TANY;
+       }
 |      fntypeh
 |      '*' type
        {
@@ -794,14 +798,6 @@ type:
                $$ = forwdcl($2);
        }
 
-polytype:
-       type
-|      LANY
-       {
-               $$ = nod(OTYPE, N, N);
-               $$->etype = TPOLY;
-       }
-
 chantype:
        {
                $$ = Cboth;