Commit aa6e81dd authored by Russ Cox's avatar Russ Cox

a few more blank tests

R=ken
OCL=34500
CL=34500
parent 079e038a
...@@ -1123,8 +1123,8 @@ methodname1(Node *n, Node *t) ...@@ -1123,8 +1123,8 @@ methodname1(Node *n, Node *t)
star = "*"; star = "*";
t = t->left; t = t->left;
} }
if(t->sym == S) if(t->sym == S || isblank(n))
return n; return newname(n->sym);
snprint(buf, sizeof(buf), "%s%S·%S", star, t->sym, n->sym); snprint(buf, sizeof(buf), "%s%S·%S", star, t->sym, n->sym);
return newname(pkglookup(buf, t->sym->package)); return newname(pkglookup(buf, t->sym->package));
} }
......
...@@ -176,6 +176,8 @@ import_stmt: ...@@ -176,6 +176,8 @@ import_stmt:
importdot(import); importdot(import);
break; break;
} }
if(my->name[0] == '_' && my->name[1] == '\0')
break;
// TODO(rsc): this line is needed for a package // TODO(rsc): this line is needed for a package
// which does bytes := in a function, which creates // which does bytes := in a function, which creates
...@@ -212,8 +214,8 @@ import_here: ...@@ -212,8 +214,8 @@ import_here:
$$ = parserline(); $$ = parserline();
pkgimportname = S; pkgimportname = S;
pkgmyname = $1; pkgmyname = $1;
if(pkgmyname->def) if($1->def && ($1->name[0] != '_' || $1->name[1] != '\0'))
redeclare(pkgmyname, "as imported package name"); redeclare($1, "as imported package name");
importfile(&$2); importfile(&$2);
} }
| '.' LLITERAL | '.' LLITERAL
...@@ -1172,6 +1174,7 @@ xdcl_list: ...@@ -1172,6 +1174,7 @@ xdcl_list:
| xdcl_list xdcl | xdcl_list xdcl
{ {
$$ = concat($1, $2); $$ = concat($1, $2);
testdclstack();
} }
vardcl_list: vardcl_list:
......
...@@ -1982,12 +1982,13 @@ typecheckfunc(Node *n) ...@@ -1982,12 +1982,13 @@ typecheckfunc(Node *n)
{ {
Type *t, *rcvr; Type *t, *rcvr;
//dump("nname", n->nname);
typecheck(&n->nname, Erv | Easgn); typecheck(&n->nname, Erv | Easgn);
if((t = n->nname->type) == T) if((t = n->nname->type) == T)
return; return;
n->type = t; n->type = t;
rcvr = getthisx(t)->type; 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); addmethod(n->shortname->sym, t, 1);
} }
...@@ -6,12 +6,20 @@ ...@@ -6,12 +6,20 @@
package main package main
import _ "fmt"
var call string var call string
type T struct { type T struct {
_, _, _ int; _, _, _ int;
} }
func (T) _() {
}
func (T) _() {
}
const ( const (
c0 = iota; c0 = iota;
_; _;
...@@ -44,8 +52,7 @@ func i() int { ...@@ -44,8 +52,7 @@ func i() int {
return 23; return 23;
} }
func main() func main() {
{
_, _ = f(); _, _ = f();
a, _ := f(); a, _ := f();
if a != 1 {panic(a)} if a != 1 {panic(a)}
......
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