Commit 72359cf8 authored by Robert Griesemer's avatar Robert Griesemer

go/types: don't exclude package unsafe from a Package's Imports list

There's no good reason to exclude it and it only makes the code more
complicated and less consistent. Having it in the list provides an
easy way to detect if a package uses operations from package unsafe.

Change-Id: I2f9b0485db0a680bd82f3b93a350b048db3f7701
Reviewed-on: https://go-review.googlesource.com/37694Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
parent 359ca5cc
......@@ -52,7 +52,7 @@ func (pkg *Package) Complete() bool { return pkg.complete }
func (pkg *Package) MarkComplete() { pkg.complete = true }
// Imports returns the list of packages directly imported by
// pkg; the list is in source order. Package unsafe is excluded.
// pkg; the list is in source order.
//
// If pkg was loaded from export data, Imports includes packages that
// provide package-level objects referenced by pkg. This may be more or
......
......@@ -215,9 +215,7 @@ func (check *Checker) collectObjects() {
// for clients; it is not needed for type-checking)
if !pkgImports[imp] {
pkgImports[imp] = true
if imp != Unsafe {
pkg.imports = append(pkg.imports, imp)
}
pkg.imports = append(pkg.imports, imp)
}
// local name overrides imported package name
......
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