summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-05-12 11:40:03 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-13 02:13:02 -0400
commite7272d53e67e72580caceae40e766c4bfeb1c398 (patch)
tree5e0d06cf3fc31e737ea385b53efe22e5916e847a /compiler/GHC/Tc
parentf6be6e432e53108075905c1fc7785d8b1f18a33f (diff)
downloadhaskell-e7272d53e67e72580caceae40e766c4bfeb1c398.tar.gz
Enhance UnitId use
* use UnitId instead of String to identify wired-in units * use UnitId instead of Unit in the backend (Unit are only use by Backpack to produce type-checked interfaces, not real code) * rename lookup functions for consistency * documentation
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r--compiler/GHC/Tc/Errors.hs2
-rw-r--r--compiler/GHC/Tc/Utils/Backpack.hs2
-rw-r--r--compiler/GHC/Tc/Utils/Monad.hs2
3 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Tc/Errors.hs b/compiler/GHC/Tc/Errors.hs
index 41bc8cd269..d38b7adcbd 100644
--- a/compiler/GHC/Tc/Errors.hs
+++ b/compiler/GHC/Tc/Errors.hs
@@ -2174,7 +2174,7 @@ sameOccExtra ty1 ty2
| otherwise -- Imported things have an UnhelpfulSrcSpan
= hang (quotes (ppr nm))
2 (sep [ text "is defined in" <+> quotes (ppr (moduleName mod))
- , ppUnless (same_pkg || pkg == mainUnitId) $
+ , ppUnless (same_pkg || pkg == mainUnit) $
nest 4 $ text "in package" <+> quotes (ppr pkg) ])
where
pkg = moduleUnit mod
diff --git a/compiler/GHC/Tc/Utils/Backpack.hs b/compiler/GHC/Tc/Utils/Backpack.hs
index 66733b0618..5643ec05fb 100644
--- a/compiler/GHC/Tc/Utils/Backpack.hs
+++ b/compiler/GHC/Tc/Utils/Backpack.hs
@@ -568,7 +568,7 @@ mergeSignatures
let insts = instUnitInsts iuid
isFromSignaturePackage =
let inst_uid = instUnitInstanceOf iuid
- pkg = getInstalledPackageDetails pkgstate (indefUnit inst_uid)
+ pkg = unsafeLookupUnitId pkgstate (indefUnit inst_uid)
in null (unitExposedModules pkg)
-- 3(a). Rename the exports according to how the dependency
-- was instantiated. The resulting export list will be accurate
diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs
index 5030c61fd3..ca85a087b6 100644
--- a/compiler/GHC/Tc/Utils/Monad.hs
+++ b/compiler/GHC/Tc/Utils/Monad.hs
@@ -265,7 +265,7 @@ initTc hsc_env hsc_src keep_rn_syntax mod loc do_this
tcg_rdr_env = emptyGlobalRdrEnv,
tcg_fix_env = emptyNameEnv,
tcg_field_env = emptyNameEnv,
- tcg_default = if moduleUnit mod == primUnitId
+ tcg_default = if moduleUnit mod == primUnit
then Just [] -- See Note [Default types]
else Nothing,
tcg_type_env = emptyNameEnv,