@@ -41,7 +41,7 @@ data ElabMode = ETyDecl | ETransLHS | ELHS | ERHS
4141
4242data ElabResult =
4343 ElabResult { resultTerm :: Term -- ^ The term resulting from elaboration
44− , resultMetavars :: [(Name, (Int, Maybe Name, Type))]
44+ , resultMetavars :: [(Name, (Int, Maybe Name, Type, [Name]))]
4545 -- ^ Information about new metavariables
4646 , resultCaseDecls :: [PDecl]
4747 -- ^ Deferred declarations as the meaning of case blocks
@@ -627,6 +627,7 @@ elab ist info emode opts fn tm
627627 lift $ tfail (Msg $ "Can't use type constructor " ++ show n ++ " here")
628628 checkPiGoal n
629629 attack; intro (Just n);
630+ addPSname n -- okay for proof search
630631 -- trace ("------ intro " ++ show n ++ " ---- \n" ++ show ptm)
631632 elabE (ina { e_inarg = True } ) (Just fc) sc; solve
632633 highlightSource nfc (AnnBoundName n False)
@@ -643,6 +644,7 @@ elab ist info emode opts fn tm
643644 ptm <- get_term
644645 hs <- get_holes
645646 introTy (Var tyn) (Just n)
647+ addPSname n -- okay for proof search
646648 focus tyn
647649
648650 elabE (ec { e_inarg = True, e_intype = True }) (Just fc) ty
@@ -651,6 +653,7 @@ elab ist info emode opts fn tm
651653 highlightSource nfc (AnnBoundName n False)
652654 elab' ina fc (PPi p n nfc Placeholder sc)
653655 = do attack; arg n (is_scoped p) (sMN 0 "ty")
656+ addPSname n -- okay for proof search
654657 elabE (ina { e_inarg = True, e_intype = True }) fc sc
655658 solve
656659 highlightSource nfc (AnnBoundName n False)
@@ -661,6 +664,7 @@ elab ist info emode opts fn tm
661664 MN _ _ -> unique_hole n
662665 _ -> return n
663666 forall n' (is_scoped p) (Var tyn)
667+ addPSname n' -- okay for proof search
664668 focus tyn
665669 let ec' = ina { e_inarg = True, e_intype = True }
666670 elabE ec' fc ty
@@ -676,6 +680,7 @@ elab ist info emode opts fn tm
676680 claim valn (Var tyn)
677681 explicit valn
678682 letbind n (Var tyn) (Var valn)
683+ addPSname n
679684 case ty of
680685 Placeholder -> return ()
681686 _ -> do focus tyn
@@ -961,6 +966,7 @@ elab ist info emode opts fn tm
961966 let unique_used = getUniqueUsed (tt_ctxt ist) ptm
962967 let n' = metavarName (namespace info) n
963968 attack
969+ psns <- getPSnames
964970 defer unique_used n'
965971 solve
966972 highlightSource nfc (AnnName n' (Just MetavarOutput) Nothing Nothing)
@@ -1620,7 +1626,7 @@ solveAuto ist fn ambigok n
16201626 g <- goal
16211627 isg <- is_guess -- if it's a guess, we're working on it recursively, so stop
16221628 when (not isg) $
1623− proofSearch' ist True ambigok 100 True Nothing fn []
1629+ proofSearch' ist True ambigok 100 True Nothing fn [] []
16241630
16251631solveAutos :: IState -> Name -> Bool -> ElabD ()
16261632solveAutos ist fn ambigok
@@ -1629,12 +1635,12 @@ solveAutos ist fn ambigok
16291635
16301636trivial' ist
16311637 = trivial (elab ist toplevel ERHS [] (sMN 0 "tac")) ist
1632−trivialHoles' h ist
1633− = trivialHoles h (elab ist toplevel ERHS [] (sMN 0 "tac")) ist
1634−proofSearch' ist rec ambigok depth prv top n hints
1638+trivialHoles' psn h ist
1639+ = trivialHoles psn h (elab ist toplevel ERHS [] (sMN 0 "tac")) ist
1640+proofSearch' ist rec ambigok depth prv top n psns hints
16351641 = do unifyProblems
16361642 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
16381644
16391645-- | Resolve type classes. This will only pick up 'normal' instances, never
16401646-- named instances (which is enforced by 'findInstances').
@@ -1674,7 +1680,7 @@ resTC' tcs defaultOn topholes depth topg fn ist
16741680 _ -> []
16751681
16761682 traceWhen ulog ("Resolving class " ++ show g ++ "\nin" ++ show env ++ "\n" ++ show okholes) $
1677− try' (trivialHoles' okholes ist)
1683+ try' (trivialHoles' [] okholes ist)
16781684 (do addDefault t tc ttypes
16791685 let stk = map fst (filter snd $ elab_stack ist)
16801686 let insts = findInstances ist t
@@ -1799,11 +1805,11 @@ resTC' tcs defaultOn topholes depth topg fn ist
17991805 isImp arg = (False, priority arg)
18001806
18011807collectDeferred :: Maybe Name -> [Name] -> Context ->
1802− Term -> State [(Name, (Int, Maybe Name, Type))] Term
1803−collectDeferred top casenames ctxt (Bind n (GHole i t) app) =
1808+ Term -> State [(Name, (Int, Maybe Name, Type, [Name]))] Term
1809+collectDeferred top casenames ctxt (Bind n (GHole i psns t) app) =
18041810 do ds <- get
18051811 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))])
18071813 collectDeferred top casenames ctxt app
18081814 where
18091815 -- 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
21182124 do actualHints <- mapM reifyTTName hs
21192125 unifyProblems
21202126 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
21222128 returnUnit
21232129 (Constant (I _), Nothing ) ->
21242130 lift . tfail . InternalMsg $ "Not a list: " ++ show hints'
@@ -2290,8 +2296,8 @@ runTac autoSolve ist perhapsFC fn tac
22902296 runT Compute = compute
22912297 runT Trivial = do trivial' ist; when autoSolve solveAll
22922298 runT TCInstance = runT (Exact (PResolveTC emptyFC))
2293− runT (ProofSearch rec prover depth top hints)
2294− = do proofSearch' ist rec False depth prover top fn hints
2299+ runT (ProofSearch rec prover depth top psns hints)
2300+ = do proofSearch' ist rec False depth prover top fn psns hints
22952301 when autoSolve solveAll
22962302 runT (Focus n) = focus n
22972303 runT Unfocus = do hs <- get_holes
@@ -2499,7 +2505,7 @@ processTacticDecls info steps =
24992505 updateIState $ \i -> i { idris_implicits =
25002506 addDef n impls (idris_implicits i) }
25012507 addIBC (IBCImp n)
2502− ds <- checkDef fc (\_ e -> e) [(n, (-1, Nothing, ty))]
2508+ ds <- checkDef fc (\_ e -> e) [(n, (-1, Nothing, ty, []))]
25032509 addIBC (IBCDef n)
25042510 ctxt <- getContext
25052511 case lookupDef n ctxt of
@@ -2508,7 +2514,7 @@ processTacticDecls info steps =
25082514 -- then it must be added as a metavariable. This needs guarding
25092515 -- to prevent overwriting case defs with a metavar, if the case
25102516 -- 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
25122518 in addDeferred ds'
25132519 _ -> return ()
25142520 RAddInstance className instName ->