[commit: ghc] master: Handle CPP properly in Backpack (e1fb283)

git at git.haskell.org git at git.haskell.org
Fri Dec 1 13:38:31 UTC 2017


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

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

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

commit e1fb28384c44fcd29b0e60b9fd44767be22646af
Author: Edward Z. Yang <ezyang at fb.com>
Date:   Sat Nov 25 10:12:05 2017 +0800

    Handle CPP properly in Backpack
    
    Summary:
    Previously, we attempted to lookup 'hole' packages for
    include directories; this obviously is not going to work.
    
    Signed-off-by: Edward Z. Yang <ezyang at fb.com>
    
    Test Plan: validate
    
    Reviewers: ekmett, bgamari
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #14525
    
    Differential Revision: https://phabricator.haskell.org/D4234


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

e1fb28384c44fcd29b0e60b9fd44767be22646af
 compiler/main/Packages.hs                            | 10 ++++++++--
 testsuite/tests/backpack/cabal/bkpcabal01/p/P.hs.in1 |  1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index c49581b..14407be 100644
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -1892,8 +1892,14 @@ listVisibleModuleNames dflags =
 getPreloadPackagesAnd :: DynFlags -> [PreloadUnitId] -> IO [PackageConfig]
 getPreloadPackagesAnd dflags pkgids0 =
   let
-      pkgids  = pkgids0 ++ map (toInstalledUnitId . moduleUnitId . snd)
-                               (thisUnitIdInsts dflags)
+      pkgids  = pkgids0 ++
+                  -- An indefinite package will have insts to HOLE,
+                  -- which is not a real package. Don't look it up.
+                  -- Fixes #14525
+                  if isIndefinite dflags
+                    then []
+                    else map (toInstalledUnitId . moduleUnitId . snd)
+                             (thisUnitIdInsts dflags)
       state   = pkgState dflags
       pkg_map = pkgIdMap state
       preload = preloadPackages state
diff --git a/testsuite/tests/backpack/cabal/bkpcabal01/p/P.hs.in1 b/testsuite/tests/backpack/cabal/bkpcabal01/p/P.hs.in1
index 327a032..875c370 100644
--- a/testsuite/tests/backpack/cabal/bkpcabal01/p/P.hs.in1
+++ b/testsuite/tests/backpack/cabal/bkpcabal01/p/P.hs.in1
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 module P where
 import H
 y = x



More information about the ghc-commits mailing list