@@ -193,9 +193,12 @@ elabCon info syn tn codata expkind dkind (doc, argDocs, n, nfc, t_in, fc, forcen
194 -- Check that the constructor type is, in fact, a part of the family being defined
194 -- Check that the constructor type is, in fact, a part of the family being defined
195 tyIs n cty'
195 tyIs n cty'
196+ -- Need to calculate forceability from the non-normalised type,
197+ -- because we might not be able to export the definitions which
198+ -- we're normalising which changes the forceability status!
196 let force = if tn == sUN "Delayed"
199 let force = if tn == sUN "Delayed"
197 then [] -- TMP HACK! Totality checker needs this info
200 then [] -- TMP HACK! Totality checker needs this info
198− else forceArgs ctxt cty'
201+ else forceArgs ctxt tn cty
200 logElab 5 $ show fc ++ ":Constructor " ++ show n ++ " elaborated : " ++ show t
203 logElab 5 $ show fc ++ ":Constructor " ++ show n ++ " elaborated : " ++ show t
201 logElab 5 $ "Inaccessible args: " ++ show inacc
204 logElab 5 $ "Inaccessible args: " ++ show inacc
@@ -264,8 +267,8 @@ elabCon info syn tn codata expkind dkind (doc, argDocs, n, nfc, t_in, fc, forcen
264 = tclift $ tfail (At fc (UniqueKindError AllTypes n))
267 = tclift $ tfail (At fc (UniqueKindError AllTypes n))
265 checkUniqueKind _ _ = return ()
268 checkUniqueKind _ _ = return ()
267−forceArgs :: Context -> Type -> [Int]
270+forceArgs :: Context -> Name -> Type -> [Int]
268−forceArgs ctxt ty = forceFrom 0 ty
271+forceArgs ctxt tn ty = forceFrom 0 ty
270 -- for each argument, substitute in MN pos "FF"
273 -- for each argument, substitute in MN pos "FF"
271 -- then when we look at the return type, if we see MN pos name
274 -- then when we look at the return type, if we see MN pos name
@@ -281,7 +284,8 @@ forceArgs ctxt ty = forceFrom 0 ty
281 -- (FIXME: Actually the real risk is if we erase something a programmer
284 -- (FIXME: Actually the real risk is if we erase something a programmer
282 -- definitely wants, which is particularly the case with 'views'.
285 -- definitely wants, which is particularly the case with 'views'.
283 -- So perhaps we need a way of marking that in the source?)
286 -- So perhaps we need a way of marking that in the source?)
284− | (P _ ty _, args) <- unApply sc
287+ | (P _ ty _, args) <- unApply sc,
288+ ty == tn -- Must be the right top level type!
285 = if null (concatMap (findNonForcePos True) args)
289 = if null (concatMap (findNonForcePos True) args)
286 then nub (concatMap findForcePos args)
290 then nub (concatMap findForcePos args)