@@ -78,14 +78,14 @@ searchIfHole : {vars : _} ->
78
78
(arg : ArgInfo vars) ->
79
79
Core ()
80
80
searchIfHole fc defaults trying ispair Z def top env arg
81
- = throw (CantSolveGoal fc [] top) -- possibly should say depth limit hit?
81
+ = throw (CantSolveGoal fc (gamma ! (get Ctxt )) [] top) -- possibly should say depth limit hit?
82
82
searchIfHole fc defaults trying ispair (S depth) def top env arg
83
83
= do let hole = holeID arg
84
84
let rig = argRig arg
85
85
86
86
defs <- get Ctxt
87
87
Just gdef <- lookupCtxtExact (Resolved hole) (gamma defs)
88
- | Nothing => throw (CantSolveGoal fc [] top)
88
+ | Nothing => throw (CantSolveGoal fc (gamma ! (get Ctxt )) [] top)
89
89
let Hole _ _ = definition gdef
90
90
| _ => pure () -- already solved
91
91
top' <- if ispair
@@ -101,7 +101,7 @@ searchIfHole fc defaults trying ispair (S depth) def top env arg
101
101
then pure ()
102
102
else do vs <- unify inTerm fc env (metaApp arg) argdef
103
103
let [] = constraints vs
104
- | _ => throw (CantSolveGoal fc [] top)
104
+ | _ => throw (CantSolveGoal fc (gamma defs) [] top)
105
105
pure ()
106
106
107
107
successful : {vars : _} ->
@@ -135,12 +135,12 @@ anyOne : {vars : _} ->
135
135
FC -> Env Term vars -> (topTy : ClosedTerm) ->
136
136
List (Core (Term vars)) ->
137
137
Core (Term vars)
138
- anyOne fc env top [] = throw (CantSolveGoal fc [] top)
138
+ anyOne fc env top [] = throw (CantSolveGoal fc (gamma ! (get Ctxt )) [] top)
139
139
anyOne fc env top [elab]
140
140
= catch elab $
141
141
\ case
142
- err@(CantSolveGoal _ _ _ ) => throw err
143
- _ => throw $ CantSolveGoal fc [] top
142
+ err@(CantSolveGoal _ _ _ _ ) => throw err
143
+ _ => throw $ CantSolveGoal fc (gamma ! (get Ctxt )) [] top
144
144
anyOne fc env top (elab :: elabs)
145
145
= tryUnify elab (anyOne fc env top elabs)
146
146
@@ -153,8 +153,8 @@ exactlyOne : {vars : _} ->
153
153
exactlyOne fc env top target [elab]
154
154
= catch elab $
155
155
\ case
156
- err@(CantSolveGoal _ _ _ ) => throw err
157
- _ => throw $ CantSolveGoal fc [] top
156
+ err@(CantSolveGoal _ _ _ _ ) => throw err
157
+ _ => throw $ CantSolveGoal fc (gamma ! (get Ctxt )) [] top
158
158
exactlyOne {vars} fc env top target all
159
159
= do elabs <- successful all
160
160
case rights elabs of
@@ -163,7 +163,7 @@ exactlyOne {vars} fc env top target all
163
163
put Ctxt defs
164
164
commit
165
165
pure res
166
- [] => throw (CantSolveGoal fc [] top)
166
+ [] => throw (CantSolveGoal fc (gamma ! (get Ctxt )) [] top)
167
167
rs => throw (AmbiguousSearch fc env ! (quote ! (get Ctxt ) env target)
168
168
! (traverse normRes rs))
169
169
where
@@ -275,7 +275,7 @@ searchLocalWith {vars} fc rigc defaults trying depth def top env (prf, ty) targe
275
275
logNF " auto" 10 " For target" env target
276
276
ures <- unify inTerm fc env target appTy
277
277
let [] = constraints ures
278
- | _ => throw (CantSolveGoal fc [] top)
278
+ | _ => throw (CantSolveGoal fc (gamma defs) [] top)
279
279
-- We can only use the local if its type is not an unsolved hole
280
280
if ! (usableLocal fc defaults env ty)
281
281
then do
@@ -290,7 +290,7 @@ searchLocalWith {vars} fc rigc defaults trying depth def top env (prf, ty) targe
290
290
(impLast args)
291
291
pure candidate
292
292
else do logNF " auto" 10 " Can't use " env ty
293
- throw (CantSolveGoal fc [] top)
293
+ throw (CantSolveGoal fc (gamma defs) [] top)
294
294
295
295
findPos : Defs -> Term vars ->
296
296
(Term vars -> Term vars) ->
@@ -300,10 +300,10 @@ searchLocalWith {vars} fc rigc defaults trying depth def top env (prf, ty) targe
300
300
findPos defs p f nty@(NTCon pfc pn _ _ [(_ , xty), (_ , yty)]) target
301
301
= handleUnify (findDirect defs prf f nty target) (\ e =>
302
302
if ambig e then throw e else
303
- do fname <- maybe (throw (CantSolveGoal fc [] top))
303
+ do fname <- maybe (throw (CantSolveGoal fc (gamma defs) [] top))
304
304
pure
305
305
! fstName
306
- sname <- maybe (throw (CantSolveGoal fc [] top))
306
+ sname <- maybe (throw (CantSolveGoal fc (gamma defs) [] top))
307
307
pure
308
308
! sndName
309
309
if ! (isPairType pn)
@@ -325,7 +325,7 @@ searchLocalWith {vars} fc rigc defaults trying depth def top env (prf, ty) targe
325
325
ytytm,
326
326
f arg])
327
327
ytynf target)]
328
- else throw (CantSolveGoal fc [] top))
328
+ else throw (CantSolveGoal fc (gamma defs) [] top))
329
329
findPos defs p f nty target
330
330
= findDirect defs p f nty target
331
331
@@ -366,9 +366,9 @@ searchName fc rigc defaults trying depth def top env target (n, ndef)
366
366
= do defs <- get Ctxt
367
367
when (not (visibleInAny (! getNS :: ! getNestedNS)
368
368
(fullname ndef) (visibility ndef))) $
369
- throw (CantSolveGoal fc [] top)
369
+ throw (CantSolveGoal fc (gamma defs) [] top)
370
370
when (BlockedHint `elem` flags ndef) $
371
- throw (CantSolveGoal fc [] top)
371
+ throw (CantSolveGoal fc (gamma defs) [] top)
372
372
373
373
let ty = type ndef
374
374
let namety : NameType
@@ -381,7 +381,7 @@ searchName fc rigc defaults trying depth def top env target (n, ndef)
381
381
(args, appTy) <- mkArgs fc rigc env nty
382
382
ures <- unify inTerm fc env target appTy
383
383
let [] = constraints ures
384
- | _ => throw (CantSolveGoal fc [] top)
384
+ | _ => throw (CantSolveGoal fc (gamma defs) [] top)
385
385
ispair <- isPairNF env nty defs
386
386
let candidate = apply fc (Ref fc namety n) (map metaApp args)
387
387
logTermNF " auto" 10 " Candidate " env candidate
@@ -401,7 +401,7 @@ searchNames : {vars : _} ->
401
401
Env Term vars -> Bool -> List Name ->
402
402
(target : NF vars) -> Core (Term vars)
403
403
searchNames fc rigc defaults trying depth defining topty env ambig [] target
404
- = throw (CantSolveGoal fc [] topty)
404
+ = throw (CantSolveGoal fc (gamma ! (get Ctxt )) [] topty)
405
405
searchNames fc rigc defaults trying depth defining topty env ambig (n :: ns) target
406
406
= do defs <- get Ctxt
407
407
visnsm <- traverse (visible (gamma defs) (currentNS defs :: nestedNS defs)) (n :: ns)
@@ -463,9 +463,9 @@ concreteDets {vars} fc defaults env top pos dets (arg :: args)
463
463
throw (DeterminingArg fc n i [] top)
464
464
concrete defs (NApp _ (NMeta n i _ ) _ ) False
465
465
= do Just (Hole _ b) <- lookupDefExact n (gamma defs)
466
- | def => throw (CantSolveGoal fc [] top)
466
+ | def => throw (CantSolveGoal fc (gamma defs) [] top)
467
467
unless (implbind b) $
468
- throw (CantSolveGoal fc [] top)
468
+ throw (CantSolveGoal fc (gamma defs) [] top)
469
469
concrete defs tm atTop = pure ()
470
470
471
471
checkConcreteDets : {vars : _} ->
@@ -535,7 +535,7 @@ searchType {vars} fc rigc defaults trying depth def checkdets top env target
535
535
(\ e => if ambig e
536
536
then throw e
537
537
else tryGroups Nothing nty (hintGroups sd))
538
- else throw (CantSolveGoal fc [] top)
538
+ else throw (CantSolveGoal fc (gamma defs) [] top)
539
539
_ => do logNF " auto" 10 " Next target: " env nty
540
540
searchLocalVars fc rigc defaults trying' depth def top env nty
541
541
where
@@ -548,7 +548,7 @@ searchType {vars} fc rigc defaults trying depth def checkdets top env target
548
548
tryGroups : Maybe Error ->
549
549
NF vars -> List (Bool , List Name) -> Core (Term vars)
550
550
tryGroups (Just err) nty [] = throw err
551
- tryGroups Nothing nty [] = throw (CantSolveGoal fc [] top)
551
+ tryGroups Nothing nty [] = throw (CantSolveGoal fc (gamma ! (get Ctxt )) [] top)
552
552
tryGroups merr nty ((ambigok, g) :: gs)
553
553
= handleUnify
554
554
(do logC " auto" 5
0 commit comments