Open
Description
It would be worthwhile to improve the documentation about how independent-goals
is supposed to interact with user specified constraints in a cabal.project or given on the command line.
For example if I have a package A
which depends on B
, if I give the solver the goal A
and enable --independent-goals
should a constraint --constraint= B == 2
apply inside the independent goal of A
?
Reasons to consider:
- The constraint does not apply inside other qualified contexts (for example, setup stanzas), so why does it apply inside a qualified goal.
- If you want a constraint to apply within ALL goals then you can already write
any.A
rather than simplyA
. - The goal of
A
is supposed to be solved "indepedently" of the rest of the goals/context, this constraint is applied at a global rather than per-goal level.
Therefore it seems like a bug to me that the constraint affects the solver when deciding which version of B
to pick when solving the independent goal for A
.
cc @grayjay
This situation is witnessed by this test, the result is A == 1, B == 2
.
testIndepGoals8 :: String -> SolverTest
testIndepGoals8 name =
constraints [ExVersionConstraint (scopeTopLevel "B") (V.thisVersion (V.mkVersion [2,0,0]))] $
independentGoals $
mkTest db name ["A"] $
solverSuccess [("A", 1), ("B", 1)]
where
db :: ExampleDb
db =
[ Right $ exAv "A" 1 [ExAny "B"]
, Right $ exAv "B" 1 []
, Right $ exAv "B" 2 []
, Right $ exAv "B" 3 []
]
Activity