@@ -497,7 +497,7 @@ checkPossible info fc tcgen fname lhs_in
497497 i <- getIState
498498 let lhs = addImplPat i lhs_in
499499 -- if the LHS type checks, it is possible
500− case elaborate ctxt (idris_datatypes i) (idris_name i) (sMN 0 "patLHS") infP initEState
500+ case elaborate (constraintNS info) ctxt (idris_datatypes i) (idris_name i) (sMN 0 "patLHS") infP initEState
501501 (erun fc (buildTC i info ELHS [] fname
502502 (allNamesIn lhs_in)
503503 (infTerm lhs))) of
@@ -507,7 +507,7 @@ checkPossible info fc tcgen fname lhs_in
507507 sendHighlighting highlights
508508 updateIState $ \i -> i { idris_name = newGName }
509509 let lhs_tm = orderPats (getInferTerm lhs')
510− case recheck ctxt' [] (forget lhs_tm) lhs_tm of
510+ case recheck (constraintNS info) ctxt' [] (forget lhs_tm) lhs_tm of
511511 OK _ -> return True
512512 err -> return False
513513 -- if it's a recoverable error, the case may become possible
@@ -580,7 +580,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
580580 "\n" ++ show (fn_ty, fn_is))
581581
582582 ((ElabResult lhs' dlhs [] ctxt' newDecls highlights newGName, probs, inj), _) <-
583− tclift $ elaborate ctxt (idris_datatypes i) (idris_name i) (sMN 0 "patLHS") infP initEState
583+ tclift $ elaborate (constraintNS info) ctxt (idris_datatypes i) (idris_name i) (sMN 0 "patLHS") infP initEState
584584 (do res <- errAt "left hand side of " fname Nothing
585585 (erun fc (buildTC i info ELHS opts fname
586586 (allNamesIn lhs_in)
@@ -608,7 +608,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
608608 ctxt <- getContext
609609 (clhs_c, clhsty) <- if not inf
610610 then recheckC_borrowing False (PEGenerated `notElem` opts)
611− [] fc id [] lhs_tm
611+ [] (constraintNS info) fc id [] lhs_tm
612612 else return (lhs_tm, lhs_ty)
613613 let clhs = Idris.Core.Evaluate.simplify ctxt [] clhs_c
614614 let borrowed = borrowedNames [] clhs
@@ -666,7 +666,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
666666 ctxt <- getContext -- new context with where block added
667667 logElab 5 "STARTING CHECK"
668668 ((rhs', defer, holes, is, probs, ctxt', newDecls, highlights, newGName), _) <-
669− tclift $ elaborate ctxt (idris_datatypes i) (idris_name i) (sMN 0 "patRHS") clhsty initEState
669+ tclift $ elaborate (constraintNS info) ctxt (idris_datatypes i) (idris_name i) (sMN 0 "patRHS") clhsty initEState
670670 (do pbinds ist lhs_tm
671671 -- proof search can use explicitly written names
672672 mapM_ addPSname (allNamesIn lhs_in)
@@ -697,7 +697,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
697697 show (map (\ (n, (_,_,t,_)) -> (n, t)) defer)
698698
699699 -- If there's holes, set the metavariables as undefinable
700− def' <- checkDef fc (\n -> Elaborating "deferred type of " n Nothing) (null holes) defer
700+ def' <- checkDef info fc (\n -> Elaborating "deferred type of " n Nothing) (null holes) defer
701701 let def'' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, False, null holes))) def'
702702 addDeferred def''
703703
@@ -723,7 +723,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
723723 -- things)
724724 <- if (null holes || null def') && not inf
725725 then recheckC_borrowing True (PEGenerated `notElem` opts)
726− borrowed fc id [] rhs'
726+ borrowed (constraintNS info) fc id [] rhs'
727727 else return (rhs', clhsty)
728728
729729 logElab 6 $ " ==> " ++ showEnvDbg [] crhsty ++ " against " ++ showEnvDbg [] clhsty
@@ -738,6 +738,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
738738 case LState.runStateT (convertsC ctxt [] crhsty clhsty) (constv, []) of
739739 OK (_, cs) -> when (PEGenerated `notElem` opts) $ do
740740 addConstraints fc cs
741+ mapM_ (\c -> addIBC (IBCConstraint fc c)) (snd cs)
741742 logElab 6 $ "CONSTRAINTS ADDED: " ++ show cs ++ "\n" ++ show (clhsty, crhsty)
742743 return ()
743744 Error e -> ierror (At fc (CantUnify False (clhsty, Nothing) (crhsty, Nothing) e [] 0))
@@ -832,7 +833,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
832833 (addImplPat i lhs_in)
833834 logElab 2 ("LHS: " ++ show lhs)
834835 (ElabResult lhs' dlhs [] ctxt' newDecls highlights newGName, _) <-
835− tclift $ elaborate ctxt (idris_datatypes i) (idris_name i) (sMN 0 "patLHS") infP initEState
836+ tclift $ elaborate (constraintNS info) ctxt (idris_datatypes i) (idris_name i) (sMN 0 "patLHS") infP initEState
836837 (errAt "left hand side of with in " fname Nothing
837838 (erun fc (buildTC i info ELHS opts fname
838839 (allNamesIn lhs_in)
@@ -848,14 +849,14 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
848849 let ret_ty = getRetTy (explicitNames (normalise ctxt [] lhs_ty))
849850 let static_names = getStaticNames i lhs_tm
850851 logElab 5 (show lhs_tm ++ "\n" ++ show static_names)
851− (clhs, clhsty) <- recheckC fc id [] lhs_tm
852+ (clhs, clhsty) <- recheckC (constraintNS info) fc id [] lhs_tm
852853 logElab 5 ("Checked " ++ show clhs)
853854 let bargs = getPBtys (explicitNames (normalise ctxt [] lhs_tm))
854855 let wval = rhs_trans info $ addImplBound i (map fst bargs) wval_in
855856 logElab 5 ("Checking " ++ showTmImpls wval)
856857 -- Elaborate wval in this context
857858 ((wval', defer, is, ctxt', newDecls, highlights, newGName), _) <-
858− tclift $ elaborate ctxt (idris_datatypes i) (idris_name i) (sMN 0 "withRHS")
859+ tclift $ elaborate (constraintNS info) ctxt (idris_datatypes i) (idris_name i) (sMN 0 "withRHS")
859860 (bindTyArgs PVTy bargs infP) initEState
860861 (do pbinds i lhs_tm
861862 -- proof search can use explicitly written names
@@ -872,14 +873,14 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
872873 sendHighlighting highlights
873874 updateIState $ \i -> i { idris_name = newGName }
874875
875− def' <- checkDef fc iderr True defer
876+ def' <- checkDef info fc iderr True defer
876877 let def'' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, False, True))) def'
877878 addDeferred def''
878879 mapM_ (elabCaseBlock info opts) is
879880 logElab 5 ("Checked wval " ++ show wval')
880881
881882 ctxt <- getContext
882− (cwval, cwvalty) <- recheckC fc id [] (getInferTerm wval')
883+ (cwval, cwvalty) <- recheckC (constraintNS info) fc id [] (getInferTerm wval')
883884 let cwvaltyN = explicitNames (normalise ctxt [] cwvalty)
884885 let cwvalN = explicitNames (normalise ctxt [] cwval)
885886 logElab 3 ("With type " ++ show cwvalty ++ "\nRet type " ++ show ret_ty)
@@ -914,7 +915,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
914915 let wargname = sMN windex "warg"
915916
916917 logElab 5 ("Abstract over " ++ show wargval ++ " in " ++ show wargtype)
917− let wtype = bindTyArgs (flip (Pi Nothing) (TType (UVar 0))) (bargs_pre ++
918+ let wtype = bindTyArgs (flip (Pi Nothing) (TType (UVar [] 0))) (bargs_pre ++
918919 (wargname, wargtype) :
919920 map (abstract wargname wargval wargtype) bargs_post ++
920921 case mpn of
@@ -937,7 +938,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
937938 addIBC (IBCImp wname)
938939 addIBC (IBCStatic wname)
939940
940− def' <- checkDef fc iderr True [(wname, (-1, Nothing, wtype, []))]
941+ def' <- checkDef info fc iderr True [(wname, (-1, Nothing, wtype, []))]
941942 let def'' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, False, True))) def'
942943 addDeferred def''
943944
@@ -970,7 +971,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
970971 ctxt <- getContext -- New context with block added
971972 i <- getIState
972973 ((rhs', defer, is, ctxt', newDecls, highlights, newGName), _) <-
973− tclift $ elaborate ctxt (idris_datatypes i) (idris_name i) (sMN 0 "wpatRHS") clhsty initEState
974+ tclift $ elaborate (constraintNS info) ctxt (idris_datatypes i) (idris_name i) (sMN 0 "wpatRHS") clhsty initEState
974975 (do pbinds i lhs_tm
975976 setNextName
976977 (ElabResult _ d is ctxt' newDecls highlights newGName) <-
@@ -983,12 +984,12 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
983984 sendHighlighting highlights
984985 updateIState $ \i -> i { idris_name = newGName }
985986
986− def' <- checkDef fc iderr True defer
987+ def' <- checkDef info fc iderr True defer
987988 let def'' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, False, True))) def'
988989 addDeferred def''
989990 mapM_ (elabCaseBlock info opts) is
990991 logElab 5 ("Checked RHS " ++ show rhs')
991− (crhs, crhsty) <- recheckC fc id [] rhs'
992+ (crhs, crhsty) <- recheckC (constraintNS info) fc id [] rhs'
992993 return $ (Right (clhs, crhs), lhs)
993994 where
994995 getImps (Bind n (Pi _ _ _) t) = pexp Placeholder : getImps t