@@ -36,7 +36,7 @@ import qualified Data.List.NonEmpty as NonEmpty
3636import Data.Map (Map )
3737import qualified Data.Map as M
3838import qualified Data.Map.Merge.Lazy as M
39- import Data.Maybe (fromJust , isJust , isNothing )
39+ import Data.Maybe (fromJust , isNothing )
4040import Data.Set (Set )
4141import qualified Data.Set as S
4242import Data.Traversable
@@ -122,9 +122,7 @@ indexUpdate res tree ix = case res of
122122 | ix == mempty -> ShrinkNoMore mempty
123123 -- A (local) test pass, i.e. shrunk input is not a property counterexample.
124124 -- If sibling nodes have been exhausted, rollback to the parent index.
125- -- 'fromJust' is safe here because the only index without parent
126- -- is the empty index.
127- | otherwise -> tryContinueIndex (Ix. succ tree) (fromJust . Ix. parent) ix
125+ | otherwise -> tryContinueIndex (Ix. succ tree) (fold . Ix. parent) ix
128126 -- When the test fails, try to stretch.
129127 TestFailure -> tryContinueIndex (Ix. stretch tree) id ix
130128
@@ -225,10 +223,8 @@ main = do
225223 testRes == TestSuccess &&
226224 (isNothing inputIndex || inputIndex == Just mempty )
227225 case (optMinimalTestOutput opts, not isGlobalSuccess) of
228- -- 'fromJust' is safe here because an index generated
229- -- by 'indexUpdate' is always on the tree.
230- (Just minimalTestFilePath, True ) -> encodeFile minimalTestFilePath (fromJust (Ix. lookup ix tree))
231- (Nothing , True ) -> print $ encode $ fromJust (Ix. lookup ix tree)
226+ (Just minimalTestFilePath, True ) -> encodeFile minimalTestFilePath (Ix. lookup ix tree)
227+ (Nothing , True ) -> print $ encode $ Ix. lookup ix tree
232228 _ -> pure ()
233229 pure mempty
234230 exitWithStatus . Flags $ testResultToFlag testRes <> mightContinueShrinking
0 commit comments