Fixed a bug where multiple problems would be deemed safe as long as one didn't have a solution (as opposed to all not having solutions)

This commit is contained in:
Neil Brown 2008-01-16 10:52:51 +00:00
parent b5606eb7a9
commit 90fb5e2182

View File

@ -59,10 +59,10 @@ checkArrayUsage tree = (mapM_ checkPar $ listify (const True) tree) >> return tr
Left err -> dieP m $ "Could not work with array indexes for array \"" ++ arrName ++ "\": " ++ err Left err -> dieP m $ "Could not work with array indexes for array \"" ++ arrName ++ "\": " ++ err
Right [] -> return () -- No problems to work with Right [] -> return () -- No problems to work with
Right problems -> Right problems ->
case mapM (\(vm,p) -> seqPair (return vm,uncurry solveProblem p)) problems of case mapMaybe (\(vm,p) -> seqPair (return vm,uncurry solveProblem p)) problems of
-- No solutions; no worries! -- No solutions; no worries!
Nothing -> return () [] -> return ()
Just ((varMapping,vm):_) -> do sol <- formatSolution varMapping (getCounterEqs vm) ((varMapping,vm):_) -> do sol <- formatSolution varMapping (getCounterEqs vm)
arrName' <- getRealName (A.Name undefined undefined arrName) arrName' <- getRealName (A.Name undefined undefined arrName)
dieP m $ "Overlapping indexes of array \"" ++ arrName' ++ "\" when: " ++ sol dieP m $ "Overlapping indexes of array \"" ++ arrName' ++ "\" when: " ++ sol