@@ -395,6 +395,9 @@ elabCon info syn tn codata (doc, argDocs, n, t_in, fc, forcenames)
395 ctxt <- getContext
395 ctxt <- getContext
396 let cty' = normalise ctxt [] cty
396 let cty' = normalise ctxt [] cty
398+ -- Check that the constructor type is, in fact, a part of the family being defined
398 logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t
401 logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t
399 logLvl 5 $ "Inaccessible args: " ++ show inacc
402 logLvl 5 $ "Inaccessible args: " ++ show inacc
400 logLvl 2 $ "---> " ++ show n ++ " : " ++ show cty'
403 logLvl 2 $ "---> " ++ show n ++ " : " ++ show cty'
@@ -407,11 +410,11 @@ elabCon info syn tn codata (doc, argDocs, n, t_in, fc, forcenames)
407 addIBC (IBCOpt n)
410 addIBC (IBCOpt n)
408 return (n, cty')
411 return (n, cty')
410− tyIs (Bind n b sc) = tyIs sc
413+ tyIs con (Bind n b sc) = tyIs con sc
411− tyIs t | (P _ n' _, _) <- unApply t
414+ tyIs con t | (P _ n' _, _) <- unApply t
412− = if n' /= tn then tclift $ tfail (At fc (Msg (show n' ++ " is not " ++ show tn)))
415+ = if n' /= tn then tclift $ tfail (At fc (Elaborating "constructor " con (Msg (show n' ++ " is not " ++ show tn))))
413 else return ()
416 else return ()
414− tyIs t = tclift $ tfail (At fc (Msg (show t ++ " is not " ++ show tn)))
417+ tyIs con t = tclift $ tfail (At fc (Elaborating "constructor " con (Msg (show t ++ " is not " ++ show tn))))
416 mkLazy (PPi pl n ty sc)
419 mkLazy (PPi pl n ty sc)
417 = let ty' = if getTyName ty
420 = let ty' = if getTyName ty