diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-05-07 18:03:36 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-13 02:13:02 -0400 |
commit | 72d086106d49bc18277f3a066e671e87e9b37a1b (patch) | |
tree | ff20c2926d4234c2cecc5d230859fc9fce09bb85 /compiler/GHC/Tc/Utils/Backpack.hs | |
parent | 7a02599afe836ac32c2e732671415d0afdfbf7fb (diff) | |
download | haskell-72d086106d49bc18277f3a066e671e87e9b37a1b.tar.gz |
Refactor homeUnit
* rename thisPackage into homeUnit
* document and refactor several Backpack things
Diffstat (limited to 'compiler/GHC/Tc/Utils/Backpack.hs')
-rw-r--r-- | compiler/GHC/Tc/Utils/Backpack.hs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/GHC/Tc/Utils/Backpack.hs b/compiler/GHC/Tc/Utils/Backpack.hs index 98458b884b..66733b0618 100644 --- a/compiler/GHC/Tc/Utils/Backpack.hs +++ b/compiler/GHC/Tc/Utils/Backpack.hs @@ -309,7 +309,7 @@ implicitRequirements' hsc_env normal_imports forM normal_imports $ \(mb_pkg, L _ imp) -> do found <- findImportedModule hsc_env imp mb_pkg case found of - Found _ mod | thisPackage dflags /= moduleUnit mod -> + Found _ mod | not (isHomeModule dflags mod) -> return (uniqDSetToList (moduleFreeHoles mod)) _ -> return [] where dflags = hsc_dflags hsc_env @@ -731,7 +731,7 @@ mergeSignatures -- STEP 4: Rename the interfaces ext_ifaces <- forM thinned_ifaces $ \((Module iuid _), ireq_iface) -> tcRnModIface (instUnitInsts iuid) (Just nsubst) ireq_iface - lcl_iface <- tcRnModIface (thisUnitIdInsts dflags) (Just nsubst) lcl_iface0 + lcl_iface <- tcRnModIface (homeUnitInstantiations dflags) (Just nsubst) lcl_iface0 let ifaces = lcl_iface : ext_ifaces -- STEP 4.1: Merge fixities (we'll verify shortly) tcg_fix_env @@ -753,7 +753,7 @@ mergeSignatures let infos = zip ifaces detailss -- Test for cycles - checkSynCycles (thisPackage dflags) (typeEnvTyCons type_env) [] + checkSynCycles (homeUnit dflags) (typeEnvTyCons type_env) [] -- NB on type_env: it contains NO dfuns. DFuns are recorded inside -- detailss, and given a Name that doesn't correspond to anything real. See @@ -1000,9 +1000,13 @@ instantiateSignature = do -- TODO: setup the local RdrEnv so the error messages look a little better. -- But this information isn't stored anywhere. Should we RETYPECHECK -- the local one just to get the information? Hmm... - MASSERT( moduleUnit outer_mod == thisPackage dflags ) + MASSERT( isHomeModule dflags outer_mod ) + MASSERT( isJust (homeUnitInstanceOfId dflags) ) + let uid = fromJust (homeUnitInstanceOfId dflags) + -- we need to fetch the most recent ppr infos from the unit + -- database because we might have modified it + uid' = updateIndefUnitId (pkgState dflags) uid inner_mod `checkImplements` Module - (mkInstantiatedUnit (thisComponentId dflags) - (thisUnitIdInsts dflags)) + (mkInstantiatedUnit uid' (homeUnitInstantiations dflags)) (moduleName outer_mod) |