@@ -774,7 +774,8 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
774774 let lhs_tm = orderPats (getInferTerm lhs')
775775 let lhs_ty = getInferType lhs'
776776 let ret_ty = getRetTy (explicitNames (normalise ctxt [] lhs_ty))
777− logLvl 3 (show lhs_tm)
777+ let static_names = getStaticNames i lhs_tm
778+ logLvl 5 (show lhs_tm ++ "\n" ++ show static_names)
778779 (clhs, clhsty) <- recheckC fc [] lhs_tm
779780 logLvl 5 ("Checked " ++ show clhs)
780781 let bargs = getPBtys (explicitNames (normalise ctxt [] lhs_tm))
@@ -800,7 +801,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
800801 (cwval, cwvalty) <- recheckC fc [] (getInferTerm wval')
801802 let cwvaltyN = explicitNames (normalise ctxt [] cwvalty)
802803 let cwvalN = explicitNames (normalise ctxt [] cwval)
803− logLvl 5 ("With type " ++ show cwvalty ++ "\nRet type " ++ show ret_ty)
804+ logLvl 3 ("With type " ++ show cwvalty ++ "\nRet type " ++ show ret_ty)
804805 let pvars = map fst (getPBtys cwvalty)
805806 -- we need the unelaborated term to get the names it depends on
806807 -- rather than a de Bruijn index.
@@ -824,7 +825,15 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
824825
825826 let imps = getImps wtype -- add to implicits context
826827 putIState (i { idris_implicits = addDef wname imps (idris_implicits i) })
828+ let statics = getStatics static_names wtype
829+ logLvl 5 ("Static positions " ++ show statics)
830+ i <- getIState
831+ putIState (i { idris_statics = addDef wname statics (idris_statics i) })
832+
827833 addIBC (IBCDef wname)
834+ addIBC (IBCImp wname)
835+ addIBC (IBCStatic wname)
836+
828837 def' <- checkDef fc [(wname, (-1, Nothing, wtype))]
829838 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
830839 addDeferred def''
@@ -866,6 +875,11 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
866875 getImps (Bind n (Pi _ _) t) = pexp Placeholder : getImps t
867876 getImps _ = []
868877
878+ getStatics ns (Bind n (Pi _ _) t)
879+ | n `elem` ns = True : getStatics ns t
880+ | otherwise = False : getStatics ns t
881+ getStatics _ _ = []
882+
869883 mkAuxC wname lhs ns ns' (PClauses fc o n cs)
870884 | True = do cs' <- mapM (mkAux wname lhs ns ns') cs
871885 return $ PClauses fc o wname cs'