Commit ff4518da authored by Russ Cox's avatar Russ Cox

gc: fix package quoting logic

The decision for when to say "hash/crc32".New instead of
crc32.New in an error was double-counting imports
from different packages or indirect imports, so it was
quoting even when there was no ambiguity.

R=ken2
CC=golang-dev
https://golang.org/cl/4645070
parent 3a52cf56
......@@ -237,8 +237,11 @@ import_here:
import_package:
LPACKAGE sym import_safety ';'
{
importpkg->name = $2->name;
pkglookup($2->name, nil)->npkg++;
if(importpkg->name == nil) {
importpkg->name = $2->name;
pkglookup($2->name, nil)->npkg++;
} else if(strcmp(importpkg->name, $2->name) != 0)
yyerror("conflicting names %s and %s for package %Z", importpkg->name, $2->name, importpkg->path);
importpkg->direct = 1;
if(safemode && !curio.importsafe)
......@@ -1658,8 +1661,11 @@ hidden_import:
Pkg *p;
p = mkpkg($3.u.sval);
p->name = $2->name;
pkglookup($2->name, nil)->npkg++;
if(p->name == nil) {
p->name = $2->name;
pkglookup($2->name, nil)->npkg++;
} else if(strcmp(p->name, $2->name) != 0)
yyerror("conflicting names %s and %s for package %Z", p->name, $2->name, p->path);
}
| LVAR hidden_pkg_importsym hidden_type ';'
{
......
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