Skip to content

Commit

Permalink
Fix a flag-handling bug related to haskell#1855.
Browse files Browse the repository at this point in the history
This was an innocent-looking but severe bug that was triggered for manual
flags in certain circumstances: if both choices of a manual flag are
already invalidated by other decisions, then the old code was removing
the nodes underneath the flag completely. As a result, there's a node
with no children rather than a node with two failure-children. The
fail-nodes carry important information that is used to compute how far
we can backtrack. If this information is removed, strange things happen.
  • Loading branch information
kosmikus committed May 19, 2014
1 parent f1a8b83 commit 3e33a0f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ enforceManualFlags = trav go
go (FChoiceF qfn gr tr True ts) = FChoiceF qfn gr tr True $
let c = toConflictSet (Goal (F qfn) gr)
in case span isDisabled (P.toList ts) of
(_ , []) -> P.fromList []
(xs, []) -> P.fromList xs -- everything's already disabled, leave everything as is
(xs, y : ys) -> P.fromList (xs ++ y : L.map (\ (b, _) -> (b, Fail c ManualFlag)) ys)
where
isDisabled (_, Fail _ _) = True
Expand Down

0 comments on commit 3e33a0f

Please sign in to comment.