Fix #532, Use first component in cabal file for dangling modules in cabal projects

This commit is contained in:
Daniel Gröber 2015-08-12 10:44:41 +02:00
parent 5318db06f7
commit 443650705c

View File

@ -188,6 +188,7 @@ targetGhcOptions crdl sefnmn = do
mcs <- cached cradleRootDir resolvedComponentsCache comps mcs <- cached cradleRootDir resolvedComponentsCache comps
let mdlcs = moduleComponents mcs `zipMap` Set.toList sefnmn let mdlcs = moduleComponents mcs `zipMap` Set.toList sefnmn
cns = map gmcName comps
candidates = findCandidates $ map snd mdlcs candidates = findCandidates $ map snd mdlcs
let noCandidates = Set.null candidates let noCandidates = Set.null candidates
@ -195,8 +196,8 @@ targetGhcOptions crdl sefnmn = do
if noCandidates && noModuleHasAnyAssignment if noCandidates && noModuleHasAnyAssignment
then do then do
gmLog GmWarning "" $ strDoc $ "Could not find a component assignment, falling back to guessed GHC options." gmLog GmWarning "" $ strDoc $ "Could not find a component assignment, falling back to picking first component in cabal file."
sandboxOpts crdl return $ gmcGhcOpts $ fromJust $ Map.lookup (head cns) mcs
else do else do
when noCandidates $ when noCandidates $
throwError $ GMECabalCompAssignment mdlcs throwError $ GMECabalCompAssignment mdlcs