@@ -455,58 +455,15 @@ checkPossible info fc tcgen fname lhs_in
455 (erun fc (buildTC i info ELHS [] fname (infTerm lhs))) of
455 (erun fc (buildTC i info ELHS [] fname (infTerm lhs))) of
456 OK (ElabResult lhs' _ _ ctxt' newDecls, _) ->
456 OK (ElabResult lhs' _ _ ctxt' newDecls, _) ->
457 do setContext ctxt'
457 do setContext ctxt'
458− processTacticDecls newDecls
458+ processTacticDecls info newDecls
459 let lhs_tm = orderPats (getInferTerm lhs')
459 let lhs_tm = orderPats (getInferTerm lhs')
460 case recheck ctxt [] (forget lhs_tm) lhs_tm of
460 case recheck ctxt [] (forget lhs_tm) lhs_tm of
461 OK _ -> return True
461 OK _ -> return True
462 err -> return False
462 err -> return False
463 -- if it's a recoverable error, the case may become possible
463 -- if it's a recoverable error, the case may become possible
464− Error err -> if tcgen then return (recoverable ctxt err)
464+ Error err -> if tcgen then return (recoverableCoverage ctxt err)
465− else return (validCase ctxt err ||
465+ else return (validCoverageCase ctxt err ||
466− recoverable ctxt err)
466+ recoverableCoverage ctxt err)
467− where validCase ctxt (CantUnify _ (topx, _) (topy, _) e _ _)
468− = let topx' = normalise ctxt [] topx
469− topy' = normalise ctxt [] topy in
470− not (sameFam topx' topy' || not (validCase ctxt e))
471− validCase ctxt (CantConvert _ _ _) = False
472− validCase ctxt (At _ e) = validCase ctxt e
473− validCase ctxt (Elaborating _ _ e) = validCase ctxt e
474− validCase ctxt (ElaboratingArg _ _ _ e) = validCase ctxt e
475− validCase ctxt _ = True
477− recoverable ctxt (CantUnify r (topx, _) (topy, _) e _ _)
478− = let topx' = normalise ctxt [] topx
479− topy' = normalise ctxt [] topy in
480− checkRec topx' topy'
481− recoverable ctxt (At _ e) = recoverable ctxt e
482− recoverable ctxt (Elaborating _ _ e) = recoverable ctxt e
483− recoverable ctxt (ElaboratingArg _ _ _ e) = recoverable ctxt e
484− recoverable _ _ = False
487− = case (unApply topx, unApply topy) of
488− ((P _ x _, _), (P _ y _, _)) -> x == y
491− -- different notion of recoverable than in unification, since we
492− -- have no metavars -- just looking to see if a constructor is failing
493− -- to unify with a function that may be reduced later
495− checkRec (App f a) p@(P _ _ _) = checkRec f p
496− checkRec p@(P _ _ _) (App f a) = checkRec p f
497− checkRec fa@(App _ _) fa'@(App _ _)
498− | (f, as) <- unApply fa,
499− (f', as') <- unApply fa'
500− = if (length as /= length as')
502− else checkRec f f' && and (zipWith checkRec as as')
503− checkRec (P xt x _) (P yt y _) = x == y || ntRec xt yt
504− checkRec _ _ = False
506− ntRec x y | Ref <- x = True
508− | (Bound, Bound) <- (x, y) = True
509− | otherwise = False -- name is different, unrecoverable
511propagateParams :: IState -> [Name] -> Type -> PTerm -> PTerm
468propagateParams :: IState -> [Name] -> Type -> PTerm -> PTerm
512propagateParams i ps t tm@(PApp _ (PRef fc n) args)
469propagateParams i ps t tm@(PApp _ (PRef fc n) args)
@@ -587,7 +544,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
587 inj <- get_inj
544 inj <- get_inj
588 return (res, probs, inj))
545 return (res, probs, inj))
589 setContext ctxt'
546 setContext ctxt'
590− processTacticDecls newDecls
547+ processTacticDecls info newDecls
591 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
548 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
593 let lhs_tm = orderPats (getInferTerm lhs')
550 let lhs_tm = orderPats (getInferTerm lhs')
@@ -672,7 +629,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
672 probs <- get_probs
629 probs <- get_probs
673 return (tm, ds, is, probs, ctxt', newDecls))
630 return (tm, ds, is, probs, ctxt', newDecls))
674 setContext ctxt'
631 setContext ctxt'
675− processTacticDecls newDecls
632+ processTacticDecls info newDecls
676 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
633 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
678 logLvl 5 "DONE CHECK"
635 logLvl 5 "DONE CHECK"
@@ -820,7 +777,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
820 (errAt "left hand side of with in " fname
777 (errAt "left hand side of with in " fname
821 (erun fc (buildTC i info ELHS opts fname (infTerm lhs))) )
778 (erun fc (buildTC i info ELHS opts fname (infTerm lhs))) )
822 setContext ctxt'
779 setContext ctxt'
823− processTacticDecls newDecls
780+ processTacticDecls info newDecls
824 let lhs_tm = orderPats (getInferTerm lhs')
781 let lhs_tm = orderPats (getInferTerm lhs')
825 let lhs_ty = getInferType lhs'
782 let lhs_ty = getInferType lhs'
826 let ret_ty = getRetTy (explicitNames (normalise ctxt [] lhs_ty))
783 let ret_ty = getRetTy (explicitNames (normalise ctxt [] lhs_ty))
@@ -844,7 +801,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
844 tt <- get_term
801 tt <- get_term
845 return (tt, d, is, ctxt', newDecls))
802 return (tt, d, is, ctxt', newDecls))
846 setContext ctxt'
803 setContext ctxt'
847− processTacticDecls newDecls
804+ processTacticDecls info newDecls
848 def' <- checkDef fc iderr defer
805 def' <- checkDef fc iderr defer
849 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
806 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
850 addDeferred def''
807 addDeferred def''
@@ -939,7 +896,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
939 tt <- get_term
896 tt <- get_term
940 return (tt, d, is, ctxt', newDecls))
897 return (tt, d, is, ctxt', newDecls))
941 setContext ctxt'
898 setContext ctxt'
942− processTacticDecls newDecls
899+ processTacticDecls info newDecls
944 def' <- checkDef fc iderr defer
901 def' <- checkDef fc iderr defer
945 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
902 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'