]> Cypherpunks repositories - gostls13.git/commitdiff
2 minor bugs
authorKen Thompson <ken@golang.org>
Wed, 10 Dec 2008 20:38:16 +0000 (12:38 -0800)
committerKen Thompson <ken@golang.org>
Wed, 10 Dec 2008 20:38:16 +0000 (12:38 -0800)
R=r
OCL=20906
CL=20906

src/cmd/gc/dcl.c
src/cmd/gc/go.y

index c1dad5d0ee1580a7db2f84d40b460fd36c7aa594..7448b6cc15c3e807f7fdc129939dfcad924bac97 100644 (file)
@@ -701,13 +701,12 @@ testdclstack(void)
 static void
 redeclare(char *str, Sym *s)
 {
-       if(s->block != block) {
-               s->block = block;
-               s->lastlineno = lineno;
-               return;
+       if(s->block == block) {
+               yyerror("%s %S redeclared in this block", str, s);
+               print(" previous declaration at %L\n", s->lastlineno);
        }
-       yyerror("%s %S redeclared in this block %d", str, s, block);
-       print(" previous declaration at %L\n", s->lastlineno);
+       s->block = block;
+       s->lastlineno = lineno;
 }
 
 void
index f504595cb75b771de8d5106f5f31afbf181d06f7..6bab8402f6db4bc43867d34fcd9410969c64a336 100644 (file)
@@ -1087,6 +1087,7 @@ nametype:
        LATYPE
        {
                if($1->otype != T && $1->otype->etype == TANY)
+               if(strcmp(package, "PACKAGE") != 0)
                        yyerror("the any type is restricted");
                $$ = oldtype($1);
        }