@@ -120,7 +120,7 @@ build ist info emode opts fn tm
120 when tydecl (do mkPat
120 when tydecl (do mkPat
121 update_term liftPats
121 update_term liftPats
122 update_term orderPats)
122 update_term orderPats)
123− EState is _ impls highlights <- getAux
123+ EState is _ impls highlights _ _ <- getAux
124 tt <- get_term
124 tt <- get_term
125 ctxt <- get_context
125 ctxt <- get_context
126 let (tm, ds) = runState (collectDeferred (Just fn) (map fst is) ctxt tt) []
126 let (tm, ds) = runState (collectDeferred (Just fn) (map fst is) ctxt tt) []
@@ -165,7 +165,7 @@ buildTC ist info emode opts fn ns tm
165 -- unification
165 -- unification
166 when (not (null dots)) $
166 when (not (null dots)) $
167 lift (Error (CantMatch (getInferTerm tm)))
167 lift (Error (CantMatch (getInferTerm tm)))
168− EState is _ impls highlights <- getAux
168+ EState is _ impls highlights _ _ <- getAux
169 tt <- get_term
169 tt <- get_term
170 ctxt <- get_context
170 ctxt <- get_context
171 let (tm, ds) = runState (collectDeferred (Just fn) (map fst is) ctxt tt) []
171 let (tm, ds) = runState (collectDeferred (Just fn) (map fst is) ctxt tt) []
@@ -412,16 +412,6 @@ elab ist info emode opts fn tm
412 [pimp (sUN "A") Placeholder False,
412 [pimp (sUN "A") Placeholder False,
413 pimp (sUN "B") Placeholder False,
413 pimp (sUN "B") Placeholder False,
414 pexp l, pexp r])
414 pexp l, pexp r])
415−-- _ -> try' (elab' ina (Just fc) (PApp fc (PRef fc pairCon)
416−-- [pimp (sUN "A") Placeholder False,
417−-- pimp (sUN "B") Placeholder False,
419−-- (elab' ina (Just fc) (PApp fc (PRef fc upairCon)
420−-- [pimp (sUN "A") Placeholder False,
421−-- pimp (sUN "B") Placeholder False,
425 elab' ina _ (PDPair fc hls p l@(PRef nfc hl n) t r)
415 elab' ina _ (PDPair fc hls p l@(PRef nfc hl n) t r)
426 = case t of
416 = case t of
427 Placeholder ->
417 Placeholder ->
@@ -589,7 +579,9 @@ elab ist info emode opts fn tm
589 | pattern && not reflection && not (e_qq ec) && e_nomatching ec
579 | pattern && not reflection && not (e_qq ec) && e_nomatching ec
590 = lift $ tfail $ Msg ("Attempting concrete match on polymorphic argument: " ++ show tm)
580 = lift $ tfail $ Msg ("Attempting concrete match on polymorphic argument: " ++ show tm)
591 | (pattern || intransform || (bindfree && bindable n)) && not (inparamBlock n) && not (e_qq ec)
581 | (pattern || intransform || (bindfree && bindable n)) && not (inparamBlock n) && not (e_qq ec)
583+ testImplicitWarning fc n ty
592− = do let ina = e_inarg ec
584+ let ina = e_inarg ec
593 guarded = e_guarded ec
585 guarded = e_guarded ec
594 inty = e_intype ec
586 inty = e_intype ec
595 ctxt <- get_context
587 ctxt <- get_context
@@ -676,6 +668,7 @@ elab ist info emode opts fn tm
676 highlightSource nfc (AnnBoundName n False)
668 highlightSource nfc (AnnBoundName n False)
677 elab' ina fc (PPi p n nfc Placeholder sc)
669 elab' ina fc (PPi p n nfc Placeholder sc)
678 = do attack; arg n (is_scoped p) (sMN 0 "ty")
670 = do attack; arg n (is_scoped p) (sMN 0 "ty")
679 addPSname n -- okay for proof search
672 addPSname n -- okay for proof search
680 elabE (ina { e_inarg = True, e_intype = True }) fc sc
673 elabE (ina { e_inarg = True, e_intype = True }) fc sc
@@ -687,6 +680,7 @@ elab ist info emode opts fn tm
687 MN _ _ -> unique_hole n
680 MN _ _ -> unique_hole n
688 _ -> return n
681 _ -> return n
689 forall n' (is_scoped p) (Var tyn)
682 forall n' (is_scoped p) (Var tyn)
690 addPSname n' -- okay for proof search
684 addPSname n' -- okay for proof search
691 focus tyn
685 focus tyn
692 let ec' = ina { e_inarg = True, e_intype = True }
686 let ec' = ina { e_inarg = True, e_intype = True }
@@ -1207,7 +1201,7 @@ elab ist info emode opts fn tm
1207 -- We now have an elaborated term. Reflect it and solve the
1201 -- We now have an elaborated term. Reflect it and solve the
1208 -- original goal in the original proof state, preserving highlighting
1202 -- original goal in the original proof state, preserving highlighting
1209 env <- get_env
1203 env <- get_env
1210− EState _ _ _ hs <- getAux
1204+ EState _ _ _ hs _ _ <- getAux
1211 loadState
1205 loadState
1212 updateAux (\aux -> aux { highlighting = hs })
1206 updateAux (\aux -> aux { highlighting = hs })
@@ -1403,8 +1397,8 @@ elab ist info emode opts fn tm
1403 -- case block functions that don't yet exist)
1397 -- case block functions that don't yet exist)
1404 fullyElaborated :: Term -> ElabD ()
1398 fullyElaborated :: Term -> ElabD ()
1405 fullyElaborated (P _ n _) =
1399 fullyElaborated (P _ n _) =
1406− do EState cases _ _ _ <- getAux
1400+ do estate <- getAux
1407− case lookup n cases of
1401+ case lookup n (case_decls estate) of
1408 Nothing -> return ()
1402 Nothing -> return ()
1409 Just _ -> lift . tfail $ ElabScriptStaging n
1403 Just _ -> lift . tfail $ ElabScriptStaging n
1410 fullyElaborated (Bind n b body) = fullyElaborated body >> for_ b fullyElaborated
1404 fullyElaborated (Bind n b body) = fullyElaborated body >> for_ b fullyElaborated
@@ -1549,6 +1543,31 @@ elab ist info emode opts fn tm
1549 elabArgs _ _ _ _ _ _ (((arg, hole), _) : _) _ [] =
1543 elabArgs _ _ _ _ _ _ (((arg, hole), _) : _) _ [] =
1550 fail $ "Can't elaborate these args: " ++ show arg ++ " " ++ show hole
1544 fail $ "Can't elaborate these args: " ++ show arg ++ " " ++ show hole
1546+ addAutoBind :: Plicity -> Name -> ElabD ()
1547+ addAutoBind (Imp _ _ _ _ False) n
1548+ = updateAux (\est -> est { auto_binds = n : auto_binds est })
1549+ addAutoBind _ _ = return ()
1551+ testImplicitWarning :: FC -> Name -> Type -> ElabD ()
1552+ testImplicitWarning fc n goal
1553+ | implicitable n && emode == ETyDecl
1554+ = do env <- get_env
1556+ when (n `elem` auto_binds est) $
1557+ tryUnify env (lookupTyName n (tt_ctxt ist))
1558+ | otherwise = return ()
1560+ tryUnify env [] = return ()
1561+ tryUnify env ((nm, ty) : ts)
1562+ = do inj <- get_inj
1564+ case unify (tt_ctxt ist) env (ty, Nothing) (goal, Nothing)
1567+ updateAux (\est -> est { implicit_warnings =
1568+ (fc, nm) : implicit_warnings est })
1569+ _ -> tryUnify env ts
1552-- For every alternative, look at the function at the head. Automatically resolve
1571-- For every alternative, look at the function at the head. Automatically resolve
1553-- any nested alternatives where that function is also at the head
1572-- any nested alternatives where that function is also at the head