[commit: ghc] master: Fix import error with -XPackageImports when the module has a duplicate name (2183ac1)

git at git.haskell.org git at git.haskell.org
Tue Jul 25 01:07:03 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2183ac16a98146bb673b5530ca154499a1c6166e/ghc

>---------------------------------------------------------------

commit 2183ac16a98146bb673b5530ca154499a1c6166e
Author: Eugene Akentyev <ak3ntev at gmail.com>
Date:   Mon Jul 24 19:53:57 2017 -0400

    Fix import error with -XPackageImports when the module has a duplicate name
    
    Reviewers: austin, bgamari, mpickering
    
    Reviewed By: bgamari
    
    Subscribers: mpickering, rwbarton, thomie
    
    GHC Trac Issues: #13168
    
    Differential Revision: https://phabricator.haskell.org/D3738


>---------------------------------------------------------------

2183ac16a98146bb673b5530ca154499a1c6166e
 compiler/typecheck/TcRnDriver.hs       | 13 +++++++++----
 testsuite/tests/typecheck/T13168/all.T |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs
index c9c259e..8a6d72e 100644
--- a/compiler/typecheck/TcRnDriver.hs
+++ b/compiler/typecheck/TcRnDriver.hs
@@ -1777,14 +1777,19 @@ runTcInteractive hsc_env thing_inside
                       vcat (map ppr [ local_gres | gres <- occEnvElts (ic_rn_gbl_env icxt)
                                                  , let local_gres = filter isLocalGRE gres
                                                  , not (null local_gres) ]) ]
-       ; let getOrphans m = fmap (\iface -> mi_module iface
+
+       ; let getOrphans m mb_pkg = fmap (\iface -> mi_module iface
                                           : dep_orphs (mi_deps iface))
                                  (loadSrcInterface (text "runTcInteractive") m
-                                                   False Nothing)
+                                                   False mb_pkg)
+
        ; orphs <- fmap concat . forM (ic_imports icxt) $ \i ->
             case i of
-                IIModule n -> getOrphans n
-                IIDecl i -> getOrphans (unLoc (ideclName i))
+                IIModule n -> getOrphans n Nothing
+                IIDecl i ->
+                  let mb_pkg = sl_fs <$> ideclPkgQual i in
+                  getOrphans (unLoc (ideclName i)) mb_pkg
+
        ; let imports = emptyImportAvails {
                             imp_orphs = orphs
                         }
diff --git a/testsuite/tests/typecheck/T13168/all.T b/testsuite/tests/typecheck/T13168/all.T
index 8552366..43a5e1b 100644
--- a/testsuite/tests/typecheck/T13168/all.T
+++ b/testsuite/tests/typecheck/T13168/all.T
@@ -1,4 +1,4 @@
 test('T13168',
-     [extra_files(['package1', 'package2', 'Setup.hs']), expect_broken(13168)],
+     extra_files(['package1', 'package2', 'Setup.hs']),
      run_command,
      ['$MAKE -s --no-print-directory T13168'])



More information about the ghc-commits mailing list