@@ -41,7 +41,7 @@ data ElabMode = ETyDecl | ETransLHS | ELHS | ERHS
42data ElabResult =
42data ElabResult =
43 ElabResult { resultTerm :: Term -- ^ The term resulting from elaboration
43 ElabResult { resultTerm :: Term -- ^ The term resulting from elaboration
44− , resultMetavars :: [(Name, (Int, Maybe Name, Type))]
44+ , resultMetavars :: [(Name, (Int, Maybe Name, Type, [Name]))]
45 -- ^ Information about new metavariables
45 -- ^ Information about new metavariables
46 , resultCaseDecls :: [PDecl]
46 , resultCaseDecls :: [PDecl]
47 -- ^ Deferred declarations as the meaning of case blocks
47 -- ^ Deferred declarations as the meaning of case blocks
@@ -627,6 +627,7 @@ elab ist info emode opts fn tm
627 lift $ tfail (Msg $ "Can't use type constructor " ++ show n ++ " here")
627 lift $ tfail (Msg $ "Can't use type constructor " ++ show n ++ " here")
628 checkPiGoal n
628 checkPiGoal n
629 attack; intro (Just n);
629 attack; intro (Just n);
630+ addPSname n -- okay for proof search
630 -- trace ("------ intro " ++ show n ++ " ---- \n" ++ show ptm)
631 -- trace ("------ intro " ++ show n ++ " ---- \n" ++ show ptm)
631 elabE (ina { e_inarg = True } ) (Just fc) sc; solve
632 elabE (ina { e_inarg = True } ) (Just fc) sc; solve
632 highlightSource nfc (AnnBoundName n False)
633 highlightSource nfc (AnnBoundName n False)
@@ -643,6 +644,7 @@ elab ist info emode opts fn tm
643 ptm <- get_term
644 ptm <- get_term
644 hs <- get_holes
645 hs <- get_holes
645 introTy (Var tyn) (Just n)
646 introTy (Var tyn) (Just n)
647+ addPSname n -- okay for proof search
646 focus tyn
648 focus tyn
648 elabE (ec { e_inarg = True, e_intype = True }) (Just fc) ty
650 elabE (ec { e_inarg = True, e_intype = True }) (Just fc) ty
@@ -651,6 +653,7 @@ elab ist info emode opts fn tm
651 highlightSource nfc (AnnBoundName n False)
653 highlightSource nfc (AnnBoundName n False)
652 elab' ina fc (PPi p n nfc Placeholder sc)
654 elab' ina fc (PPi p n nfc Placeholder sc)
653 = do attack; arg n (is_scoped p) (sMN 0 "ty")
655 = do attack; arg n (is_scoped p) (sMN 0 "ty")
656+ addPSname n -- okay for proof search
654 elabE (ina { e_inarg = True, e_intype = True }) fc sc
657 elabE (ina { e_inarg = True, e_intype = True }) fc sc
656 highlightSource nfc (AnnBoundName n False)
659 highlightSource nfc (AnnBoundName n False)
@@ -661,6 +664,7 @@ elab ist info emode opts fn tm
661 MN _ _ -> unique_hole n
664 MN _ _ -> unique_hole n
662 _ -> return n
665 _ -> return n
663 forall n' (is_scoped p) (Var tyn)
666 forall n' (is_scoped p) (Var tyn)
667+ addPSname n' -- okay for proof search
664 focus tyn
668 focus tyn
665 let ec' = ina { e_inarg = True, e_intype = True }
669 let ec' = ina { e_inarg = True, e_intype = True }
666 elabE ec' fc ty
670 elabE ec' fc ty
@@ -676,6 +680,7 @@ elab ist info emode opts fn tm
676 claim valn (Var tyn)
680 claim valn (Var tyn)
677 explicit valn
681 explicit valn
678 letbind n (Var tyn) (Var valn)
682 letbind n (Var tyn) (Var valn)
679 case ty of
684 case ty of
680 Placeholder -> return ()
685 Placeholder -> return ()
681 _ -> do focus tyn
686 _ -> do focus tyn
@@ -961,6 +966,7 @@ elab ist info emode opts fn tm
961 let unique_used = getUniqueUsed (tt_ctxt ist) ptm
966 let unique_used = getUniqueUsed (tt_ctxt ist) ptm
962 let n' = metavarName (namespace info) n
967 let n' = metavarName (namespace info) n
964 defer unique_used n'
970 defer unique_used n'
966 highlightSource nfc (AnnName n' (Just MetavarOutput) Nothing Nothing)
972 highlightSource nfc (AnnName n' (Just MetavarOutput) Nothing Nothing)
@@ -1620,7 +1626,7 @@ solveAuto ist fn ambigok n
1620 g <- goal
1626 g <- goal
1621 isg <- is_guess -- if it's a guess, we're working on it recursively, so stop
1627 isg <- is_guess -- if it's a guess, we're working on it recursively, so stop
1622 when (not isg) $
1628 when (not isg) $
1623− proofSearch' ist True ambigok 100 True Nothing fn []
1629+ proofSearch' ist True ambigok 100 True Nothing fn [] []
1625solveAutos :: IState -> Name -> Bool -> ElabD ()
1631solveAutos :: IState -> Name -> Bool -> ElabD ()
1626solveAutos ist fn ambigok
1632solveAutos ist fn ambigok
@@ -1629,12 +1635,12 @@ solveAutos ist fn ambigok
1630trivial' ist
1636trivial' ist
1631 = trivial (elab ist toplevel ERHS [] (sMN 0 "tac")) ist
1637 = trivial (elab ist toplevel ERHS [] (sMN 0 "tac")) ist
1632−trivialHoles' h ist
1638+trivialHoles' psn h ist
1633− = trivialHoles h (elab ist toplevel ERHS [] (sMN 0 "tac")) ist
1639+ = trivialHoles psn h (elab ist toplevel ERHS [] (sMN 0 "tac")) ist
1634−proofSearch' ist rec ambigok depth prv top n hints
1640+proofSearch' ist rec ambigok depth prv top n psns hints
1635 = do unifyProblems
1641 = do unifyProblems
1636 proofSearch rec prv ambigok (not prv) depth
1642 proofSearch rec prv ambigok (not prv) depth
1637− (elab ist toplevel ERHS [] (sMN 0 "tac")) top n hints ist
1643+ (elab ist toplevel ERHS [] (sMN 0 "tac")) top n psns hints ist
1639-- | Resolve type classes. This will only pick up 'normal' instances, never
1645-- | Resolve type classes. This will only pick up 'normal' instances, never
1640-- named instances (which is enforced by 'findInstances').
1646-- named instances (which is enforced by 'findInstances').
@@ -1674,7 +1680,7 @@ resTC' tcs defaultOn topholes depth topg fn ist
1676 traceWhen ulog ("Resolving class " ++ show g ++ "\nin" ++ show env ++ "\n" ++ show okholes) $
1682 traceWhen ulog ("Resolving class " ++ show g ++ "\nin" ++ show env ++ "\n" ++ show okholes) $
1677− try' (trivialHoles' okholes ist)
1683+ try' (trivialHoles' [] okholes ist)
1678 (do addDefault t tc ttypes
1684 (do addDefault t tc ttypes
1679 let stk = map fst (filter snd $ elab_stack ist)
1685 let stk = map fst (filter snd $ elab_stack ist)
1680 let insts = findInstances ist t
1686 let insts = findInstances ist t
@@ -1799,11 +1805,11 @@ resTC' tcs defaultOn topholes depth topg fn ist
1799 isImp arg = (False, priority arg)
1805 isImp arg = (False, priority arg)
1801collectDeferred :: Maybe Name -> [Name] -> Context ->
1807collectDeferred :: Maybe Name -> [Name] -> Context ->
1802− Term -> State [(Name, (Int, Maybe Name, Type))] Term
1808+ Term -> State [(Name, (Int, Maybe Name, Type, [Name]))] Term
1803−collectDeferred top casenames ctxt (Bind n (GHole i t) app) =
1809+collectDeferred top casenames ctxt (Bind n (GHole i psns t) app) =
1804 do ds <- get
1810 do ds <- get
1805 t' <- collectDeferred top casenames ctxt t
1811 t' <- collectDeferred top casenames ctxt t
1806− when (not (n `elem` map fst ds)) $ put (ds ++ [(n, (i, top, tidyArg [] t'))])
1812+ when (not (n `elem` map fst ds)) $ put (ds ++ [(n, (i, top, tidyArg [] t', psns))])
1807 collectDeferred top casenames ctxt app
1813 collectDeferred top casenames ctxt app
1809 -- Evaluate the top level functions in arguments, if possible, and if it's
1815 -- Evaluate the top level functions in arguments, if possible, and if it's
@@ -2118,7 +2124,7 @@ runElabAction ist fc env tm ns = do tm' <- eval tm
2118 do actualHints <- mapM reifyTTName hs
2124 do actualHints <- mapM reifyTTName hs
2119 unifyProblems
2125 unifyProblems
2120 let psElab = elab ist toplevel ERHS [] (sMN 0 "tac")
2126 let psElab = elab ist toplevel ERHS [] (sMN 0 "tac")
2121− proofSearch True True False False i psElab Nothing (sMN 0 "search ") actualHints ist
2127+ proofSearch True True False False i psElab Nothing (sMN 0 "search ") [] actualHints ist
2122 returnUnit
2128 returnUnit
2123 (Constant (I _), Nothing ) ->
2129 (Constant (I _), Nothing ) ->
2124 lift . tfail . InternalMsg $ "Not a list: " ++ show hints'
2130 lift . tfail . InternalMsg $ "Not a list: " ++ show hints'
@@ -2290,8 +2296,8 @@ runTac autoSolve ist perhapsFC fn tac
2290 runT Compute = compute
2296 runT Compute = compute
2291 runT Trivial = do trivial' ist; when autoSolve solveAll
2297 runT Trivial = do trivial' ist; when autoSolve solveAll
2292 runT TCInstance = runT (Exact (PResolveTC emptyFC))
2298 runT TCInstance = runT (Exact (PResolveTC emptyFC))
2293− runT (ProofSearch rec prover depth top hints)
2299+ runT (ProofSearch rec prover depth top psns hints)
2294− = do proofSearch' ist rec False depth prover top fn hints
2300+ = do proofSearch' ist rec False depth prover top fn psns hints
2295 when autoSolve solveAll
2301 when autoSolve solveAll
2296 runT (Focus n) = focus n
2302 runT (Focus n) = focus n
2297 runT Unfocus = do hs <- get_holes
2303 runT Unfocus = do hs <- get_holes
@@ -2499,7 +2505,7 @@ processTacticDecls info steps =
2499 updateIState $ \i -> i { idris_implicits =
2505 updateIState $ \i -> i { idris_implicits =
2500 addDef n impls (idris_implicits i) }
2506 addDef n impls (idris_implicits i) }
2501 addIBC (IBCImp n)
2507 addIBC (IBCImp n)
2502− ds <- checkDef fc (\_ e -> e) [(n, (-1, Nothing, ty))]
2508+ ds <- checkDef fc (\_ e -> e) [(n, (-1, Nothing, ty, []))]
2503 addIBC (IBCDef n)
2509 addIBC (IBCDef n)
2504 ctxt <- getContext
2510 ctxt <- getContext
2505 case lookupDef n ctxt of
2511 case lookupDef n ctxt of
@@ -2508,7 +2514,7 @@ processTacticDecls info steps =
2508 -- then it must be added as a metavariable. This needs guarding
2514 -- then it must be added as a metavariable. This needs guarding
2509 -- to prevent overwriting case defs with a metavar, if the case
2515 -- to prevent overwriting case defs with a metavar, if the case
2510 -- defs come after the type decl in the same script!
2516 -- defs come after the type decl in the same script!
2511− let ds' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) ds
2517+ let ds' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, True))) ds
2512 in addDeferred ds'
2518 in addDeferred ds'
2513 _ -> return ()
2519 _ -> return ()
2514 RAddInstance className instName ->
2520 RAddInstance className instName ->