@@ -63,7 +63,8 @@ elabType info syn doc fc opts n ty' = {- let ty' = piBind (params info) ty_in
6363 tclift $ elaborate ctxt n (TType (UVal 0)) []
6464 (errAt "type of " n (erun fc (build i info False n ty)))
6565 ds <- checkDef fc defer
66− addDeferred ds
66+ let ds' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) ds
67+ addDeferred ds'
6768 mapM_ (elabCaseBlock info opts) is
6869 ctxt <- getContext
6970 logLvl 5 $ "Rechecking"
@@ -89,7 +90,8 @@ elabType info syn doc fc opts n ty' = {- let ty' = piBind (params info) ty_in
8990 let opts' = if corec then (Coinductive : opts) else opts
9091 ds <- checkDef fc [(n, (-1, Nothing, nty))]
9192 addIBC (IBCDef n)
92− addDeferred ds
93+ let ds' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) ds
94+ addDeferred ds'
9395 setFlags n opts'
9496 addDocStr n doc
9597 addIBC (IBCDoc n)
@@ -143,7 +145,8 @@ elabData info syn doc fc codata (PLaterdecl n t_in)
143145 ((t', defer, is), log) <- tclift $ elaborate ctxt n (TType (UVal 0)) []
144146 (erun fc (build i info False n t))
145147 def' <- checkDef fc defer
146− addDeferredTyCon def'
148+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) def'
149+ addDeferredTyCon def''
147150 mapM_ (elabCaseBlock info []) is
148151 (cty, _) <- recheckC fc [] t'
149152 logLvl 2 $ "---> " ++ show cty
@@ -160,7 +163,8 @@ elabData info syn doc fc codata (PDatadecl n t_in dcons)
160163 tclift $ elaborate ctxt n (TType (UVal 0)) []
161164 (errAt "data declaration " n (erun fc (build i info False n t)))
162165 def' <- checkDef fc defer
163− addDeferredTyCon def'
166+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) def'
167+ addDeferredTyCon def''
164168 mapM_ (elabCaseBlock info []) is
165169 (cty, _) <- recheckC fc [] t'
166170 logLvl 2 $ "---> " ++ show cty
@@ -507,7 +511,8 @@ elabCon info syn tn codata (doc, n, t_in, fc)
507511 (errAt "constructor " n (erun fc (build i info False n t)))
508512 logLvl 2 $ "Rechecking " ++ show t'
509513 def' <- checkDef fc defer
510− addDeferred def'
514+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) def'
515+ addDeferred def''
511516 mapM_ (elabCaseBlock info []) is
512517 ctxt <- getContext
513518 (cty, _) <- recheckC fc [] t'
@@ -860,7 +865,8 @@ elabValBind info aspat tm_in
860865 let vtm = orderPats (getInferTerm tm')
861866
862867 def' <- checkDef (fileFC "(input)") defer
863− addDeferred def'
868+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) def'
869+ addDeferred def''
864870 mapM_ (elabCaseBlock info []) is
865871
866872 logLvl 3 ("Value: " ++ show vtm)
@@ -980,7 +986,8 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
980986 logLvl 2 $ "---> " ++ show rhs'
981987 when (not (null defer)) $ iLOG $ "DEFERRED " ++ show defer
982988 def' <- checkDef fc defer
983− addDeferred def'
989+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
990+ addDeferred def''
984991
985992 -- Now the remaining deferred (i.e. no type declarations) clauses
986993 -- from the where block
@@ -1099,7 +1106,8 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
10991106 tt <- get_term
11001107 return (tt, d, is))
11011108 def' <- checkDef fc defer
1102− addDeferred def'
1109+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
1110+ addDeferred def''
11031111 mapM_ (elabCaseBlock info opts) is
11041112 (cwval, cwvalty) <- recheckC fc [] (getInferTerm wval')
11051113 let cwvaltyN = explicitNames cwvalty
@@ -1130,7 +1138,8 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
11301138 putIState (i { idris_implicits = addDef wname imps (idris_implicits i) })
11311139 addIBC (IBCDef wname)
11321140 def' <- checkDef fc [(wname, (-1, Nothing, wtype))]
1133− addDeferred def'
1141+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
1142+ addDeferred def''
11341143
11351144 -- in the subdecls, lhs becomes:
11361145 -- fname pats | wpat [rest]
@@ -1158,7 +1167,8 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
11581167 tt <- get_term
11591168 return (tt, d, is))
11601169 def' <- checkDef fc defer
1161− addDeferred def'
1170+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
1171+ addDeferred def''
11621172 mapM_ (elabCaseBlock info opts) is
11631173 logLvl 5 ("Checked RHS " ++ show rhs')
11641174 (crhs, crhsty) <- recheckC fc [] rhs'