Commit 5600435f authored by Russ Cox's avatar Russ Cox

produce diagnostic for

import "fmt"
var fmt = 1

R=ken
OCL=33556
CL=33561
parent 0a162a14
......@@ -97,6 +97,7 @@ dowidth(Type *t)
{
int32 et;
uint32 w;
int lno;
if(maxround == 0 || widthptr == 0)
fatal("dowidth without betypeinit");
......@@ -108,11 +109,16 @@ dowidth(Type *t)
return;
if(t->width == -2) {
lno = lineno;
lineno = t->lineno;
yyerror("invalid recursive type %T", t);
t->width = 0;
lineno = lno;
return;
}
lno = lineno;
lineno = t->lineno;
t->width = -2;
et = t->etype;
......@@ -218,6 +224,7 @@ dowidth(Type *t)
}
t->width = w;
lineno = lno;
}
void
......
......@@ -143,6 +143,7 @@ struct Type
uchar deferwidth;
Node* nod; // canonical OTYPE node
int lineno;
// TFUNCT
uchar thistuple;
......
......@@ -177,14 +177,6 @@ import_stmt:
break;
}
// In order to allow multifile packages to use type names
// that are the same as the package name (i.e. go/parser
// is package parser and has a type called parser), we have
// to not bother trying to declare the package if it is our package.
// TODO(rsc): Is there a better way to tell if the package is ours?
if(my == import && strcmp(import->name, package) == 0)
break;
// TODO(rsc): this line is needed for a package
// which does bytes := in a function, which creates
// an ONONAME for bytes, but then a different file
......@@ -197,7 +189,7 @@ import_stmt:
my->def = nod(OPACK, N, N);
my->def->sym = import;
my->lastlineno = $1;
import->block = -1; // above top level
import->block = 1; // at top level
}
......
......@@ -447,6 +447,7 @@ l0:
switch(c) {
case EOF:
lineno = prevlineno;
ungetc(EOF);
return -1;
......
......@@ -392,6 +392,7 @@ typ(int et)
t = mal(sizeof(*t));
t->etype = et;
t->width = BADWIDTH;
t->lineno = lineno;
return t;
}
......
......@@ -567,7 +567,7 @@ func exec(c *http.Conn, args []string) bool {
}
func sync(c *http.Conn, r *http.Request) {
func dosync(c *http.Conn, r *http.Request) {
args := []string{"/bin/sh", "-c", *syncCmd};
if !exec(c, args) {
*syncMin = 0; // disable sync
......@@ -622,7 +622,7 @@ func main() {
http.Handle(Pkg, http.HandlerFunc(servePkg));
if *syncCmd != "" {
http.Handle("/debug/sync", http.HandlerFunc(sync));
http.Handle("/debug/sync", http.HandlerFunc(dosync));
}
http.Handle("/", http.HandlerFunc(serveFile));
......@@ -638,7 +638,7 @@ func main() {
log.Stderrf("sync every %dmin", *syncMin);
}
for *syncMin > 0 {
sync(nil, nil);
dosync(nil, nil);
time.Sleep(int64(*syncMin) * (60 * 1e9));
}
if *verbose {
......
......@@ -161,10 +161,10 @@ BUG: 0 1
BUG: errchk: command succeeded unexpectedly
=========== bugs/bug190.go
<epoch>: invalid recursive type []S
<epoch>: invalid recursive type S
<epoch>: invalid recursive type S
<epoch>: invalid recursive type chan S
<epoch>: invalid recursive type S
<epoch>: invalid recursive type func(S) (S)
bugs/bug190.go:11: invalid recursive type []S
bugs/bug190.go:16: invalid recursive type S
bugs/bug190.go:16: invalid recursive type S
bugs/bug190.go:13: invalid recursive type chan S
bugs/bug190.go:16: invalid recursive type S
bugs/bug190.go:15: invalid recursive type func(S) (S)
BUG: should compile
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