@@ -57,8 +57,9 @@ elabType info syn doc fc opts n ty' = {- let ty' = piBind (params info) ty_in
57 ty' <- implicit syn n ty'
57 ty' <- implicit syn n ty'
58 let ty = addImpl i ty'
58 let ty = addImpl i ty'
59 logLvl 2 $ show n ++ " type " ++ showImp Nothing True False ty
59 logLvl 2 $ show n ++ " type " ++ showImp Nothing True False ty
60+ ((tyT, defer, is), log) <-
60− ((tyT, defer, is), log) <- tclift $ elaborate ctxt n (TType (UVal 0)) []
61+ tclift $ elaborate ctxt n (TType (UVal 0)) []
61− (erun fc (build i info False n ty))
62+ (errAt "type of " n (erun fc (build i info False n ty)))
62 ds <- checkDef fc defer
63 ds <- checkDef fc defer
63 addDeferred ds
64 addDeferred ds
64 mapM_ (elabCaseBlock info) is
65 mapM_ (elabCaseBlock info) is
@@ -139,8 +140,9 @@ elabData info syn doc fc codata (PDatadecl n t_in dcons)
139 i <- getIState
140 i <- getIState
140 t_in <- implicit syn n t_in
141 t_in <- implicit syn n t_in
141 let t = addImpl i t_in
142 let t = addImpl i t_in
143+ ((t', defer, is), log) <-
142− ((t', defer, is), log) <- tclift $ elaborate ctxt n (TType (UVal 0)) []
144+ tclift $ elaborate ctxt n (TType (UVal 0)) []
143− (erun fc (build i info False n t))
145+ (errAt "data declaration " n (erun fc (build i info False n t)))
144 def' <- checkDef fc defer
146 def' <- checkDef fc defer
145 addDeferredTyCon def'
147 addDeferredTyCon def'
146 mapM_ (elabCaseBlock info) is
148 mapM_ (elabCaseBlock info) is
@@ -484,8 +486,9 @@ elabCon info syn tn codata (doc, n, t_in, fc)
484 t_in <- implicit syn n (if codata then mkLazy t_in else t_in)
486 t_in <- implicit syn n (if codata then mkLazy t_in else t_in)
485 let t = addImpl i t_in
487 let t = addImpl i t_in
486 logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ showImp Nothing True False t
488 logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ showImp Nothing True False t
489+ ((t', defer, is), log) <-
487− ((t', defer, is), log) <- tclift $ elaborate ctxt n (TType (UVal 0)) []
490+ tclift $ elaborate ctxt n (TType (UVal 0)) []
488− (erun fc (build i info False n t))
491+ (errAt "constructor " n (erun fc (build i info False n t)))
489 logLvl 2 $ "Rechecking " ++ show t'
492 logLvl 2 $ "Rechecking " ++ show t'
490 def' <- checkDef fc defer
493 def' <- checkDef fc defer
491 addDeferred def'
494 addDeferred def'
@@ -800,7 +803,8 @@ elabClause info tcgen (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
800 logLvl 4 ("Fixed parameters: " ++ show params ++ " from " ++ show (fn_ty, fn_is))
803 logLvl 4 ("Fixed parameters: " ++ show params ++ " from " ++ show (fn_ty, fn_is))
801 ((lhs', dlhs, []), _) <-
804 ((lhs', dlhs, []), _) <-
802 tclift $ elaborate ctxt (MN 0 "patLHS") infP []
805 tclift $ elaborate ctxt (MN 0 "patLHS") infP []
806+ (errAt "left hand side of " fname
803− (erun fc (buildTC i info True tcgen fname (infTerm lhs)))
807+ (erun fc (buildTC i info True tcgen fname (infTerm lhs))))
804 let lhs_tm = orderPats (getInferTerm lhs')
808 let lhs_tm = orderPats (getInferTerm lhs')
805 let lhs_ty = getInferType lhs'
809 let lhs_ty = getInferType lhs'
806 logLvl 3 ("Elaborated: " ++ show lhs_tm)
810 logLvl 3 ("Elaborated: " ++ show lhs_tm)
@@ -835,8 +839,10 @@ elabClause info tcgen (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
835 ((rhs', defer, is), _) <-
839 ((rhs', defer, is), _) <-
836 tclift $ elaborate ctxt (MN 0 "patRHS") clhsty []
840 tclift $ elaborate ctxt (MN 0 "patRHS") clhsty []
837 (do pbinds lhs_tm
841 (do pbinds lhs_tm
842+ (_, _, is) <- errAt "right hand side of " fname
838− (_, _, is) <- erun fc (build i info False fname rhs)
843+ (erun fc (build i info False fname rhs))
844+ errAt "right hand side of " fname
839− erun fc $ psolve lhs_tm
845+ (erun fc $ psolve lhs_tm)
840 tt <- get_term
846 tt <- get_term
841 let (tm, ds) = runState (collectDeferred tt) []
847 let (tm, ds) = runState (collectDeferred tt) []
842 return (tm, ds, is))
848 return (tm, ds, is))
@@ -934,7 +940,8 @@ elabClause info tcgen (_, PWith fc fname lhs_in withs wval_in withblock)
934 logLvl 5 ("LHS: " ++ showImp Nothing True False lhs)
940 logLvl 5 ("LHS: " ++ showImp Nothing True False lhs)
935 ((lhs', dlhs, []), _) <-
941 ((lhs', dlhs, []), _) <-
936 tclift $ elaborate ctxt (MN 0 "patLHS") infP []
942 tclift $ elaborate ctxt (MN 0 "patLHS") infP []
943+ (errAt "left hand side of with in " fname
937− (erun fc (buildTC i info True tcgen fname (infTerm lhs)))
944+ (erun fc (buildTC i info True tcgen fname (infTerm lhs))) )
938 let lhs_tm = orderPats (getInferTerm lhs')
945 let lhs_tm = orderPats (getInferTerm lhs')
939 let lhs_ty = getInferType lhs'
946 let lhs_ty = getInferType lhs'
940 let ret_ty = getRetTy lhs_ty
947 let ret_ty = getRetTy lhs_ty
@@ -950,7 +957,8 @@ elabClause info tcgen (_, PWith fc fname lhs_in withs wval_in withblock)
950 (bindTyArgs PVTy bargs infP) []
957 (bindTyArgs PVTy bargs infP) []
951 (do pbinds lhs_tm
958 (do pbinds lhs_tm
952 -- TODO: may want where here - see winfo abpve
959 -- TODO: may want where here - see winfo abpve
960+ (_', d, is) <- errAt "with value in " fname
953− (_', d, is) <- erun fc (build i info False fname (infTerm wval))
961+ (erun fc (build i info False fname (infTerm wval)))
954 erun fc $ psolve lhs_tm
962 erun fc $ psolve lhs_tm
955 tt <- get_term
963 tt <- get_term
956 return (tt, d, is))
964 return (tt, d, is))