Commit 2fe9c408 authored by Franz Thoma's avatar Franz Thoma
Browse files

Make error message clearer

The error displayed is the first error, which matches the first
conflict set in the non-exhaustive case. In the exhaustive case,
however, we display the last conflict set alongside the first error.

The change in the error message, »the rest of the dependency tree«,
should make it clearer that the error may not come from the final
branches of the dependency tree, but that there may be a lot of branches
being traversed between the first error and the final conflict set, so
they may not be congruent.

(Reasoning for displaying the first rather than the last error in the
non-exhaustive case: Both the first and the last error may be occur near
the leaves, so the conflict set may be incomplete. At the first
backjump, however, the conflicts are more likely to be relevant as the
solver has made fewer compromises at that point.
In the exhaustive case, this is not relevant as the final conflict set
is located at the root, so the conflict set contains all the conflicts
of a certain path through the tree. This is much more useful than the
first conflict set.)

Example:

```
> ./.stack-work/install/x86_64-linux-nix/ghc-8.0.1/8.0.1/bin/cabal install --dry-run cabal-install-1.24.0.0 cabal-install-1.22.9.0
Warning: The package list for 'hackage.haskell.org' is 46 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: cabal-install (user goal)
rejecting: cabal-install-1.24.0.0 (constraint from user target requires
==1.22.9.0)
rejecting: cabal-install-1.22.9.0 (constraint from user target requires
==1.24.0.0)
rejecting: cabal-install-1.22.8.0, cabal-install-1.22.7.0,
cabal-install-1.22.6.0, cabal-install-1.22.5.0, cabal-install-1.22.4.0,
cabal-install-1.22.3.0, cabal-install-1.22.2.0, cabal-install-1.22.0.1,
cabal-install-1.22.0.0, cabal-install-1.20.2.0, cabal-install-1.20.1.0,
cabal-install-1.20.0.6, cabal-install-1.20.0.5, cabal-install-1.20.0.4,
cabal-install-1.20.0.3, cabal-install-1.20.0.2, cabal-install-1.20.0.1,
cabal-install-1.20.0.0, cabal-install-1.18.2.0, cabal-install-1.18.1.0,
cabal-install-1.18.0.8, cabal-install-1.18.0.7, cabal-install-1.18.0.6,
cabal-install-1.18.0.5, cabal-install-1.18.0.4, cabal-install-1.18.0.3,
cabal-install-1.18.0.2, cabal-install-1.18.0.1, cabal-install-1.18.0,
cabal-install-1.16.1.0, cabal-install-1.16.0.2, cabal-install-1.16.0.1,
cabal-install-1.16.0, cabal-install-0.14.1, cabal-install-0.14.0,
cabal-install-0.10.2, cabal-install-0.10.0, cabal-install-0.8.2,
cabal-install-0.8.0, cabal-install-0.6.4, cabal-install-0.6.2,
cabal-install-0.6.0, cabal-install-0.5.2, cabal-install-0.5.1,
cabal-install-0.5.0, cabal-install-0.4.0 (constraint from user target requires
==1.22.9.0)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cabal-install (49)
```
parent 6075e8bd
......@@ -84,8 +84,8 @@ logToProgress mbj l = let
unlines (messages $ showMessages (L.foldr (\ v _ -> v `CS.member` cs) True) False ms) ++
case exh of
Exhaustive ->
"Dependency tree exhaustively searched.\n" ++
"I've had most trouble fulfilling the following goals: "
"After searching the rest of the dependency tree exhaustively, "
++ "these were the goals I've had most trouble fulfilling: "
++ CS.showCSWithFrequency cm cs
BackjumpLimitReached ->
"Backjump limit reached (" ++ currlimit mbj ++
......
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