From 2974ecdae50dbeb7d0cec04f18d5f627ed79629b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 3 Sep 2019 23:35:13 +0000 Subject: [PATCH] compiler: only import variable into . if same package If we dot-import a package, we should only add an imported variable to the package bindings if the variable is in the package being imported. A test case for this is the 1.13 os package, in which ErrClosed and friends are defined both locally and in the imported internal/oserror package. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192718 From-SVN: r275358 --- gcc/go/gofrontend/MERGE | 2 +- gcc/go/gofrontend/import.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 0add2f0..b334136 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -3b8a505824abb2a69f4c04c555a4ba29ab8b102b +ca0fdb4c7735a648b8f10f1248631adf9afb8454 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/import.cc b/gcc/go/gofrontend/import.cc index 64c1ef2..bbc8d7d 100644 --- a/gcc/go/gofrontend/import.cc +++ b/gcc/go/gofrontend/import.cc @@ -777,7 +777,7 @@ Import::import_var() this->location_); Named_object* no; no = vpkg->add_variable(name, var); - if (this->add_to_globals_) + if (this->add_to_globals_ && vpkg == this->package_) this->gogo_->add_dot_import_object(no); } -- 2.7.4