@@ -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'
@@ -858,7 +863,8 @@ elabValBind info aspat tm_in
858863 let vtm = orderPats (getInferTerm tm')
859864
860865 def' <- checkDef (fileFC "(input)") defer
861− addDeferred def'
866+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) def'
867+ addDeferred def''
862868 mapM_ (elabCaseBlock info []) is
863869
864870 logLvl 3 ("Value: " ++ show vtm)
@@ -978,7 +984,8 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
978984 logLvl 2 $ "---> " ++ show rhs'
979985 when (not (null defer)) $ iLOG $ "DEFERRED " ++ show defer
980986 def' <- checkDef fc defer
981− addDeferred def'
987+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
988+ addDeferred def''
982989
983990 -- Now the remaining deferred (i.e. no type declarations) clauses
984991 -- from the where block
@@ -1097,7 +1104,8 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
10971104 tt <- get_term
10981105 return (tt, d, is))
10991106 def' <- checkDef fc defer
1100− addDeferred def'
1107+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
1108+ addDeferred def''
11011109 mapM_ (elabCaseBlock info opts) is
11021110 (cwval, cwvalty) <- recheckC fc [] (getInferTerm wval')
11031111 let cwvaltyN = explicitNames cwvalty
@@ -1128,7 +1136,8 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
11281136 putIState (i { idris_implicits = addDef wname imps (idris_implicits i) })
11291137 addIBC (IBCDef wname)
11301138 def' <- checkDef fc [(wname, (-1, Nothing, wtype))]
1131− addDeferred def'
1139+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
1140+ addDeferred def''
11321141
11331142 -- in the subdecls, lhs becomes:
11341143 -- fname pats | wpat [rest]
@@ -1156,7 +1165,8 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
11561165 tt <- get_term
11571166 return (tt, d, is))
11581167 def' <- checkDef fc defer
1159− addDeferred def'
1168+ let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
1169+ addDeferred def''
11601170 mapM_ (elabCaseBlock info opts) is
11611171 logLvl 5 ("Checked RHS " ++ show rhs')
11621172 (crhs, crhsty) <- recheckC fc [] rhs'