summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-04-07 09:08:54 -0500
committerAustin Seipp <austin@well-typed.com>2015-04-07 09:13:30 -0500
commitcf1d9751e7ca85e9b3284ad57882958b8dc73d16 (patch)
tree6d7e3d719f2aeff818036e63783afc707cdc0366
parentab76b0990e9f7d20bde403be38935f9d16491806 (diff)
downloadhaskell-cf1d9751e7ca85e9b3284ad57882958b8dc73d16.tar.gz
Don't repeat package key with -dppr-debug when package info is missing.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D802
-rw-r--r--compiler/basicTypes/Module.hs12
-rw-r--r--compiler/main/Packages.hs8
-rw-r--r--compiler/main/Packages.hs-boot2
3 files changed, 11 insertions, 11 deletions
diff --git a/compiler/basicTypes/Module.hs b/compiler/basicTypes/Module.hs
index 1cf0cbfa97..a20de2d0b3 100644
--- a/compiler/basicTypes/Module.hs
+++ b/compiler/basicTypes/Module.hs
@@ -326,11 +326,13 @@ stablePackageKeyCmp p1 p2 = packageKeyFS p1 `compare` packageKeyFS p2
instance Outputable PackageKey where
ppr pk = getPprStyle $ \sty -> sdocWithDynFlags $ \dflags ->
- text (packageKeyPackageIdString dflags pk)
- -- Don't bother qualifying if it's wired in!
- <> (if qualPackage sty pk && not (pk `elem` wiredInPackageKeys)
- then char '@' <> ftext (packageKeyFS pk)
- else empty)
+ case packageKeyPackageIdString dflags pk of
+ Nothing -> ftext (packageKeyFS pk)
+ Just pkg -> text pkg
+ -- Don't bother qualifying if it's wired in!
+ <> (if qualPackage sty pk && not (pk `elem` wiredInPackageKeys)
+ then char '@' <> ftext (packageKeyFS pk)
+ else empty)
instance Binary PackageKey where
put_ bh pid = put_ bh (packageKeyFS pid)
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index 4f8afb5e91..70476a16bd 100644
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -1354,12 +1354,10 @@ missingDependencyMsg (Just parent)
-- -----------------------------------------------------------------------------
-packageKeyPackageIdString :: DynFlags -> PackageKey -> String
+packageKeyPackageIdString :: DynFlags -> PackageKey -> Maybe String
packageKeyPackageIdString dflags pkg_key
- | pkg_key == mainPackageKey = "main"
- | otherwise = maybe "(unknown)"
- sourcePackageIdString
- (lookupPackage dflags pkg_key)
+ | pkg_key == mainPackageKey = Just "main"
+ | otherwise = fmap sourcePackageIdString (lookupPackage dflags pkg_key)
-- | Will the 'Name' come from a dynamically linked library?
isDllName :: DynFlags -> PackageKey -> Module -> Name -> Bool
diff --git a/compiler/main/Packages.hs-boot b/compiler/main/Packages.hs-boot
index 2f898f19d3..f2343b66c9 100644
--- a/compiler/main/Packages.hs-boot
+++ b/compiler/main/Packages.hs-boot
@@ -3,4 +3,4 @@ module Packages where
import {-# SOURCE #-} Module (PackageKey)
import {-# SOURCE #-} DynFlags (DynFlags)
data PackageState
-packageKeyPackageIdString :: DynFlags -> PackageKey -> String
+packageKeyPackageIdString :: DynFlags -> PackageKey -> Maybe String