on master help sign in
Generate cases for coverage from 'impossible'

Apparently I did this in a bit of a hurry, and missed the necessary cases for pairs and dependent pairs without leaving any note to say so. Oops, sorry! This fixes #2610.

commit8b1502accc8fc7c8ed9adb0a7808fe83d9e8492f authorEdwin Brady <ecb10@st-andrews.ac.uk> dateTue 31 May 2016, 23:34 (10 years ago) parent83ef000
2 files changed+9−1
src/Idris/Coverage.hs+7−1 src/Idris/Elab/Clause.hs+2
src/Idris/Coverage.hs+7−1
@@ -40,6 +40,12 @@ mkPatTm t = do i <- getIState
4040 toTT (PApp _ t args) = do t' <- toTT t
4141 args' <- mapM (toTT . getTm) args
4242 return $ mkApp t' args'
43+ toTT (PDPair _ _ _ l _ r) = do l' <- toTT l
44+ r' <- toTT r
45+ return $ mkApp (P Ref sigmaCon Erased) [Erased, Erased, l', r']
46+ toTT (PPair _ _ _ l r) = do l' <- toTT l
47+ r' <- toTT r
48+ return $ mkApp (P Ref pairCon Erased) [Erased, Erased, l', r']
4349 -- For alternatives, pick the first and drop the namespaces. It doesn't
4450 -- really matter which is taken since matching will ignore the namespace.
4551 toTT (PAlternative _ _ (a : as)) = toTT a
@@ -78,7 +84,7 @@ genClauses fc n xs given
7884 logCoverage 5 $ show (map length argss) ++ "\n" ++ show (map length all_args)
7985 logCoverage 10 $ show argss ++ "\n" ++ show all_args
8086 logCoverage 3 $ "Original: \n" ++
81− showSep "\n" (map (\t -> showTm i (delab' i t True True)) xs)
87+ showSep "\n" (map (\t -> showTmImpls (delab' i t True True)) xs)
8288 -- add an infinite supply of explicit arguments to update the possible
8389 -- cases for (the return type may be variadic, or function type, so
8490 -- there may be more case splitting that the idris_implicits record
src/Idris/Elab/Clause.hs+2
@@ -539,6 +539,8 @@ elabClause info opts (_, PClause fc fname lhs_in [] PImpossible [])
539539 True -> tclift $ tfail (At fc
540540 (Msg $ show lhs_in ++ " is a valid case"))
541541 False -> do ptm <- mkPatTm lhs_in
542+ logElab 5 $ "Elaborated impossible case " ++ showTmImpls lhs ++
543+ "\n" ++ show ptm
542544 return (Left ptm, lhs)
543545elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as whereblock)
544546 = do let tcgen = Dictionary `elem` opts