@@ -119,9 +119,10 @@ resolveExports env mn imps exps refs =
119 extract useQual name render = fmap (map (importName . head . snd)) . go . M.toList
119 extract useQual name render = fmap (map (importName . head . snd)) . go . M.toList
121 go = filterM $ \(name', options) -> do
121 go = filterM $ \(name', options) -> do
122− let isMatch = if useQual then eqQual name name' else any (eqQual name . importName) options
122+ let isMatch = if useQual then isQualifiedWith name name' else any (checkUnqual name') options
123 when (isMatch && length options > 1) $ void $ checkImportConflicts mn render options
123 when (isMatch && length options > 1) $ void $ checkImportConflicts mn render options
124 return isMatch
124 return isMatch
125+ checkUnqual name' ir = isUnqualified name' && isQualifiedWith name (importName ir)
126 -- Check whether a module name refers to a "pseudo module" that came into
127 -- Check whether a module name refers to a "pseudo module" that came into
127 -- existence in an import scope due to importing one or more modules as
128 -- existence in an import scope due to importing one or more modules as
@@ -134,21 +135,16 @@ resolveExports env mn imps exps refs =
134 -- value being re-exported belongs to a qualified module, and we test the
135 -- value being re-exported belongs to a qualified module, and we test the
135 -- values if that fails to see whether the value has been imported at all.
136 -- values if that fails to see whether the value has been imported at all.
136 testQuals :: (forall a b. M.Map (Qualified a) b -> [Qualified a]) -> ModuleName -> Bool
137 testQuals :: (forall a b. M.Map (Qualified a) b -> [Qualified a]) -> ModuleName -> Bool
137− testQuals f mn' = any (eqQual mn') (f (importedTypes imps))
138+ testQuals f mn' = any (isQualifiedWith mn') (f (importedTypes imps))
138− || any (eqQual mn') (f (importedDataConstructors imps))
139+ || any (isQualifiedWith mn') (f (importedDataConstructors imps))
139− || any (eqQual mn') (f (importedTypeClasses imps))
140+ || any (isQualifiedWith mn') (f (importedTypeClasses imps))
140− || any (eqQual mn') (f (importedValues imps))
141+ || any (isQualifiedWith mn') (f (importedValues imps))
142 -- Check whether a module name refers to a module that has been imported
143 -- Check whether a module name refers to a module that has been imported
143 -- without qualification into an import scope.
144 -- without qualification into an import scope.
144 isImportedModule :: ModuleName -> Bool
145 isImportedModule :: ModuleName -> Bool
145 isImportedModule = flip elem (importedModules imps)
146 isImportedModule = flip elem (importedModules imps)
147− -- Check whether a module name matches that of a qualified value.
148− eqQual :: ModuleName -> Qualified a -> Bool
149− eqQual mn'' (Qualified (Just mn''') _) = mn'' == mn'''
152 -- Constructs a list of types with their data constructors and the original
148 -- Constructs a list of types with their data constructors and the original
153 -- module they were defined in from a list of type and data constructor names.
149 -- module they were defined in from a list of type and data constructor names.
154 resolveTypeExports
150 resolveTypeExports