@@ -9,7 +9,7 @@ import Idris.Core.CaseTree
9import Idris.AbsSyntax
9import Idris.AbsSyntax
10import Idris.Delaborate
10import Idris.Delaborate
11import Idris.Error
11import Idris.Error
12−import Idris.Output (iWarn)
12+import Idris.Output (iWarn, iputStrLn)
14import Data.List
14import Data.List
15import Data.Either
15import Data.Either
@@ -255,13 +255,14 @@ checkAllCovering fc done top n | not (n `elem` done)
255 case lookupTotal n (tt_ctxt i) of
255 case lookupTotal n (tt_ctxt i) of
256 [tot@(Partial NotCovering)] ->
256 [tot@(Partial NotCovering)] ->
257 do let msg = show top ++ " is " ++ show tot ++ " due to " ++ show n
257 do let msg = show top ++ " is " ++ show tot ++ " due to " ++ show n
258− addIBC (IBCTotCheckErr fc msg)
259 putIState i { idris_totcheckfail = (fc, msg) : idris_totcheckfail i }
258 putIState i { idris_totcheckfail = (fc, msg) : idris_totcheckfail i }
260− _ -> return ()
259+ addIBC (IBCTotCheckErr fc msg)
261− case lookupCtxt n (idris_callgraph i) of
261+ case lookupCtxt n (idris_callgraph i) of
262− [cg] -> mapM_ (checkAllCovering fc (n : done) top)
262+ [cg] -> mapM_ (checkAllCovering fc (n : done) top)
263− (map fst (calls cg))
263+ (map fst (calls cg))
264− _ -> return ()
265+ x -> return () -- stop if total
265checkAllCovering _ _ _ _ = return ()
266checkAllCovering _ _ _ _ = return ()
267-- Check if, in a given type n, the constructor cn : ty is strictly positive,
268-- Check if, in a given type n, the constructor cn : ty is strictly positive,
@@ -415,6 +416,10 @@ checkDeclTotality (fc, n)
415-- buildSCG (fc, n)
416-- buildSCG (fc, n)
416-- logLvl 2 $ "Built SCG"
417-- logLvl 2 $ "Built SCG"
417 i <- getIState
418 i <- getIState
419+ let opts = case lookupCtxt n (idris_flags i) of
422+ when (CoveringFn `elem` opts) $ checkAllCovering fc [] n n
418 t <- checkTotality [] fc n
423 t <- checkTotality [] fc n
419 case t of
424 case t of
420 -- if it's not total, it can't reduce, to keep
425 -- if it's not total, it can't reduce, to keep