Add better handling for empty component assignments

This commit is contained in:
Daniel Gröber 2015-03-08 17:32:17 +01:00
parent baf5cad809
commit a6d3f477bc

View File

@ -172,7 +172,15 @@ targetGhcOptions crdl sefnmn = do
let mdlcs = moduleComponents mcs `zipMap` Set.toList sefnmn
candidates = Set.unions $ map snd mdlcs
when (Set.null candidates) $
let noCandidates = Set.null candidates
noModuleHasAnyAssignment = all (Set.null . snd) mdlcs
if noCandidates && noModuleHasAnyAssignment
then do
gmLog GmWarning "" $ strDoc $ "Could not find a componenet assignment, falling back to sandbox only project options."
sandboxOpts crdl
else do
when noCandidates $
throwError $ GMECabalCompAssignment mdlcs
let cn = pickComponent candidates