Patchwork [gccgo] Fix bug importing package with same name as current package

login
register
mail settings
Submitter Ian Taylor
Date June 22, 2010, 8:35 p.m.
Message ID <mcr4oguls9k.fsf@dhcp-172-17-9-151.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/56566/
State New
Headers show

Comments

Ian Taylor - June 22, 2010, 8:35 p.m.
This patch fixes a bug when importing a package whose name is the same
as the current package, but which lives in a different directory.
Committed to gccgo branch.

Ian

Patch

diff -r fafa9c01a826 go/gogo.cc
--- a/go/gogo.cc	Tue Jun 22 11:37:46 2010 -0700
+++ b/go/gogo.cc	Tue Jun 22 13:31:02 2010 -0700
@@ -443,7 +443,8 @@ 
 {
   // FIXME: Now that we compile packages as a whole, should we permit
   // importing the current package?
-  if (this->package_name() == real_name)
+  if (this->package_name() == real_name
+      && this->unique_prefix() == unique_prefix)
     {
       *padd_to_globals = false;
       if (!alias_arg.empty() && alias_arg != ".")