// errors if a conflicting top-level name is
// introduced by a different file.
if(!s->def->used && !nsyntaxerrors)
- yyerrorl(s->def->lineno, "imported and not used: %s", s->def->sym->name);
+ yyerrorl(s->def->lineno, "imported and not used: %Z", s->def->pkg->path);
s->def = N;
continue;
}
// throw away top-level name left over
// from previous import . "x"
if(s->def->pack != N && !s->def->pack->used && !nsyntaxerrors) {
- yyerrorl(s->def->pack->lineno, "imported and not used: %s", s->def->pack->sym->name);
+ yyerrorl(s->def->pack->lineno, "imported and not used: %Z", s->def->pack->pkg->path);
s->def->pack->used = 1;
}
s->def = N;
}
if(n == 0) {
// can't possibly be used - there were no symbols
- yyerrorl(pack->lineno, "imported and not used: %s", pack->sym->name);
+ yyerrorl(pack->lineno, "imported and not used: %Z", opkg->path);
}
}
case OARRAYLIT:
case OMAPLIT:
case OSTRUCTLIT:
- arraylit:
nvar = nod(OXXX, N, N);
tempname(nvar, n->type);
anylit(n, nvar, init);
--- /dev/null
+// $G $D/empty.go && errchk $G $D/$F.go
+
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+// various kinds of imported and not used
+
+// standard
+import "fmt" // ERROR "imported and not used.*fmt"
+
+// renamed
+import X "math" // ERROR "imported and not used.*math"
+
+// import dot
+import . "bufio" // ERROR "imported and not used.*bufio"
+
+// again, package without anything in it
+import "./empty" // ERROR "imported and not used.*empty"
+import Z "./empty" // ERROR "imported and not used.*empty"
+import . "./empty" // ERROR "imported and not used.*empty"
+