Commit c808656b authored by Edward Z. Yang's avatar Edward Z. Yang Committed by Ben Gamari
Browse files

Make mkQualPackage more robust when package key is bad.

Signed-off-by: default avatarEdward Z. Yang <>

Test Plan: validate

Reviewers: bgamari, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10624
parent 677552f2
......@@ -1588,15 +1588,14 @@ mkQualPackage dflags pkg_key
-- Skip the lookup if it's main, since it won't be in the package
-- database!
= False
| searchPackageId dflags pkgid `lengthIs` 1
| Just pkgid <- mb_pkgid
, searchPackageId dflags pkgid `lengthIs` 1
-- this says: we are given a package pkg-0.1@MMM, are there only one
-- exposed packages whose package ID is pkg-0.1?
= False
| otherwise
= True
where pkg = fromMaybe (pprPanic "qual_pkg" (ftext (packageKeyFS pkg_key)))
(lookupPackage dflags pkg_key)
pkgid = sourcePackageId pkg
where mb_pkgid = fmap sourcePackageId (lookupPackage dflags pkg_key)
-- | A function which only qualifies package names if necessary; but
-- qualifies all other identifiers.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment