1
0
mirror of https://github.com/golang/go synced 2024-11-19 14:34:42 -07:00

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
This commit is contained in:
Russ Cox 2011-06-28 23:58:35 -04:00
parent 3a52cf56f8
commit ff4518da17

View File

@ -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 ';'
{