diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2016-10-06 00:17:15 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2016-10-08 01:37:33 -0700 |
commit | 4e8a0607140b23561248a41aeaf837224aa6315b (patch) | |
tree | 8e03945afe5c40c13b41667e0175f14db15d0780 /utils/ghc-pkg | |
parent | 00b530d5402aaa37e4085ecdcae0ae54454736c1 (diff) | |
download | haskell-4e8a0607140b23561248a41aeaf837224aa6315b.tar.gz |
Distinguish between UnitId and InstalledUnitId.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'utils/ghc-pkg')
-rw-r--r-- | utils/ghc-pkg/Main.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 4a72ba7cc6..c0474423de 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -1119,6 +1119,7 @@ convertPackageInfoToCacheFormat pkg = GhcPkg.haddockHTMLs = haddockHTMLs pkg, GhcPkg.exposedModules = map convertExposed (exposedModules pkg), GhcPkg.hiddenModules = hiddenModules pkg, + GhcPkg.indefinite = indefinite pkg, GhcPkg.exposed = exposed pkg, GhcPkg.trusted = trusted pkg } @@ -1156,9 +1157,12 @@ instance GhcPkg.DbUnitIdModuleRep ComponentId OpenUnitId ModuleName OpenModule w toDbModule (OpenModule uid mod_name) = GhcPkg.DbModule uid mod_name toDbModule (OpenModuleVar mod_name) = GhcPkg.DbModuleVar mod_name fromDbUnitId (GhcPkg.DbUnitId cid insts) = IndefFullUnitId cid (Map.fromList insts) - fromDbUnitId (GhcPkg.DbHashedUnitId cid bs) = DefiniteUnitId (DefUnitId (UnitId cid (fmap fromStringRep bs))) + fromDbUnitId (GhcPkg.DbInstalledUnitId cid bs) + = DefiniteUnitId (unsafeMkDefUnitId (UnitId cid (fmap fromStringRep bs))) toDbUnitId (IndefFullUnitId cid insts) = GhcPkg.DbUnitId cid (Map.toList insts) - toDbUnitId (DefiniteUnitId (DefUnitId (UnitId cid mb_hash))) = GhcPkg.DbHashedUnitId cid (fmap toStringRep mb_hash) + toDbUnitId (DefiniteUnitId def_uid) + | UnitId cid mb_hash <- unDefUnitId def_uid + = GhcPkg.DbInstalledUnitId cid (fmap toStringRep mb_hash) -- ----------------------------------------------------------------------------- -- Exposing, Hiding, Trusting, Distrusting, Unregistering are all similar @@ -1809,8 +1813,9 @@ checkModule :: String -> Validate () checkModule _ _ _ (OpenModuleVar _) = error "Impermissible reexport" checkModule field_name db_stack pkg - (OpenModule (DefiniteUnitId (DefUnitId definingPkgId)) definingModule) = - let mpkg = if definingPkgId == installedUnitId pkg + (OpenModule (DefiniteUnitId def_uid) definingModule) = + let definingPkgId = unDefUnitId def_uid + mpkg = if definingPkgId == installedUnitId pkg then Just pkg else PackageIndex.lookupUnitId ipix definingPkgId in case mpkg of |