@@ -271,7 +271,7 @@ checkAllCovering _ _ _ _ = return ()
272checkPositive :: [Name] -> (Name, Type) -> Idris Totality
272checkPositive :: [Name] -> (Name, Type) -> Idris Totality
273checkPositive mut_ns (cn, ty')
273checkPositive mut_ns (cn, ty')
274− = do let ty = delazy ty'
274+ = do let ty = delazy' True ty'
275 let p = cp ty
275 let p = cp ty
276 i <- getIState
276 i <- getIState
277 let tot = if p then Total (args ty) else Partial NotPositive
277 let tot = if p then Total (args ty) else Partial NotPositive
@@ -284,12 +284,19 @@ checkPositive mut_ns (cn, ty')
284 args t = [0..length (getArgTys t)-1]
284 args t = [0..length (getArgTys t)-1]
286 cp (Bind n (Pi aty) sc) = posArg aty && cp sc
286 cp (Bind n (Pi aty) sc) = posArg aty && cp sc
287+ cp t | (P _ n' _, args) <- unApply t,
288+ n' `elem` mut_ns = all noRec args
287− cp t = True
289+ cp _ = True
289 posArg (Bind _ (Pi nty) sc)
291 posArg (Bind _ (Pi nty) sc)
290 | (P _ n' _, args) <- unApply nty
292 | (P _ n' _, args) <- unApply nty
291− = n' `notElem` mut_ns && posArg sc
293+ = n' `notElem` mut_ns && all noRec args && posArg sc
292− posArg t = True
294+ posArg t | (P _ n' _, args) <- unApply t,
295+ n' `elem` mut_ns = all noRec args
298+ noRec arg = all (\x -> x `notElem` mut_ns) (allTTNames arg)
294calcProd :: IState -> FC -> Name -> [([Name], Term, Term)] -> Idris Totality
301calcProd :: IState -> FC -> Name -> [([Name], Term, Term)] -> Idris Totality
295calcProd i fc topn pats
302calcProd i fc topn pats