]> Cypherpunks.ru repositories - gostls13.git/commitdiff
a few more blank tests
authorRuss Cox <rsc@golang.org>
Wed, 9 Sep 2009 23:59:41 +0000 (16:59 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 9 Sep 2009 23:59:41 +0000 (16:59 -0700)
R=ken
OCL=34500
CL=34500

src/cmd/gc/dcl.c
src/cmd/gc/go.y
src/cmd/gc/typecheck.c
test/blank.go

index 8e6c1718458d1897a318dbd41fa208eafd893a3f..356314296cecad5bd292e1a1201cab02f93ad51b 100644 (file)
@@ -1123,8 +1123,8 @@ methodname1(Node *n, Node *t)
                star = "*";
                t = t->left;
        }
-       if(t->sym == S)
-               return n;
+       if(t->sym == S || isblank(n))
+               return newname(n->sym);
        snprint(buf, sizeof(buf), "%s%S·%S", star, t->sym, n->sym);
        return newname(pkglookup(buf, t->sym->package));
 }
index f784c862abced1a8df9050e07dffe09da9ac1caf..61f8b2b2ee40a4323c1513fc56a0c3446e985992 100644 (file)
@@ -176,6 +176,8 @@ import_stmt:
                        importdot(import);
                        break;
                }
+               if(my->name[0] == '_' && my->name[1] == '\0')
+                       break;
 
                // TODO(rsc): this line is needed for a package
                // which does bytes := in a function, which creates
@@ -212,8 +214,8 @@ import_here:
                $$ = parserline();
                pkgimportname = S;
                pkgmyname = $1;
-               if(pkgmyname->def)
-                       redeclare(pkgmyname, "as imported package name");
+               if($1->def && ($1->name[0] != '_' || $1->name[1] != '\0'))
+                       redeclare($1, "as imported package name");
                importfile(&$2);
        }
 |      '.' LLITERAL
@@ -1172,6 +1174,7 @@ xdcl_list:
 |      xdcl_list xdcl
        {
                $$ = concat($1, $2);
+               testdclstack();
        }
 
 vardcl_list:
index cf46414cab283fabefb0be0a2d14e6c998df0cf7..d33e9e8094736e48223770fb9e0dc68c7fa6e8c4 100644 (file)
@@ -61,7 +61,7 @@ typecheck(Node **np, int top)
        n = *np;
        if(n == N)
                return N;
-       
+
        // Skip typecheck if already done.
        // But re-typecheck ONAME/OTYPE/OLITERAL/OPACK node in case context has changed.
        if(n->typecheck == 1) {
@@ -614,7 +614,7 @@ reswitch:
                }
                yyerror("cannot slice %#N (type %T)", l, t);
                goto error;
-       
+
        /*
         * call and call like
         */
@@ -1196,7 +1196,7 @@ checkconv(Type *nt, Type *t, int explicit, int *op, int *et)
         */
        if(nt == T)
                return 0;
-       
+
        if(t->etype == TBLANK) {
                *op = OCONVNOP;
                return 0;
@@ -1982,12 +1982,13 @@ typecheckfunc(Node *n)
 {
        Type *t, *rcvr;
 
+//dump("nname", n->nname);
        typecheck(&n->nname, Erv | Easgn);
        if((t = n->nname->type) == T)
                return;
        n->type = t;
 
        rcvr = getthisx(t)->type;
-       if(rcvr != nil && n->shortname != N)
+       if(rcvr != nil && n->shortname != N && !isblank(n->shortname))
                addmethod(n->shortname->sym, t, 1);
 }
index 4919841a4274a8ae4615ba55a3f8f4bd11e88458..634844352ecd3eb19a6c17d93403842dbd436a2f 100644 (file)
@@ -6,12 +6,20 @@
 
 package main
 
+import _ "fmt"
+
 var call string
 
 type T struct {
        _, _, _ int;
 }
 
+func (T) _() {
+}
+
+func (T) _() {
+}
+
 const (
        c0 = iota;
        _;
@@ -44,8 +52,7 @@ func i() int {
        return 23;
 }
 
-func main()
-{
+func main() {
        _, _ = f();
        a, _ := f();
        if a != 1 {panic(a)}