@@ -218,6 +218,23 @@ genAll i args
218218
219219upd p' p = p { getTm = p' }
220220
221+-- Check whether function and all descendants cover all cases (partial is
222+-- okay, as long as it's due to recursion)
223+
224+checkAllCovering :: FC -> [Name] -> Name -> Name -> Idris ()
225+checkAllCovering fc done top n | not (n `elem` done)
226+ = do i <- get
227+ case lookupTotal n (tt_ctxt i) of
228+ [tot@(Partial NotCovering)] ->
229+ tclift $ tfail (At fc (Msg (show top ++ " is " ++ show tot
230+ ++ " due to " ++ show n)))
231+ _ -> return ()
232+ case lookupCtxt n (idris_callgraph i) of
233+ [cg] -> mapM_ (checkAllCovering fc (n : done) top)
234+ (map fst (calls cg))
235+ _ -> return ()
236+checkAllCovering _ _ _ _ = return ()
237+
221238-- Check if, in a given type n, the constructor cn : ty is strictly positive,
222239-- and update the context accordingly
223240