Skip to content

Commit b502b7f

Browse files
committed
Solver: soft prefs for optional stanzas are very weak
This should have been part of the main patch for this feature. This part of the feature takes stanza choice nodes that have been marked as being soft preferences and makes them "weak", in the same sense (and via the same mechanism) that we have weak flag choices. With this change, weak flags choices remain as the weakest, with stanza prefs are second weakest. The intention is that we don't try too hard to enable optional stanzas, ie we don't cause too much additional backtracking.
1 parent 41eb7e8 commit b502b7f

File tree

1 file changed

+3
-0
lines changed
  • cabal-install/Distribution/Client/Dependency/Modular

1 file changed

+3
-0
lines changed

cabal-install/Distribution/Client/Dependency/Modular/Preference.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,12 @@ deferWeakFlagChoices = trav go
324324
go (GoalChoiceF xs) = GoalChoiceF (P.sortBy defer xs)
325325
go x = x
326326

327+
-- weak flags go very last, weak stanzas second last
327328
defer :: Tree a -> Tree a -> Ordering
328329
defer (FChoice _ _ True _ _) _ = GT
329330
defer _ (FChoice _ _ True _ _) = LT
331+
defer (SChoice _ _ True _) _ = GT
332+
defer _ (SChoice _ _ True _) = LT
330333
defer _ _ = EQ
331334

332335
-- Transformation that sorts choice nodes so that

0 commit comments

Comments
 (0)