File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 12
12
data Elab : Type -> Type where
13
13
Pure : a -> Elab a
14
14
Bind : Elab a -> (a -> Elab b) -> Elab b
15
- Fail : String -> Elab a
15
+ Fail : FC -> String -> Elab a
16
16
17
17
LogMsg : String -> Nat -> String -> Elab ()
18
18
LogTerm : String -> Nat -> String -> TTImp -> Elab ()
@@ -63,7 +63,11 @@ Monad Elab where
63
63
||| Report an error in elaboration
64
64
export
65
65
fail : String -> Elab a
66
- fail = Fail
66
+ fail = Fail EmptyFC
67
+
68
+ export
69
+ failAt : FC -> String -> Elab a
70
+ failAt = Fail
67
71
68
72
||| Write a log message, if the log level is >= the given level
69
73
export
Original file line number Diff line number Diff line change @@ -63,9 +63,12 @@ elabScript fc nest env script@(NDCon nfc nm t ar args) exp
63
63
! (sc defs (toClosure withAll env
64
64
! (quote defs env act'))) exp
65
65
x => failWith defs $ " non-function RHS of a Bind: " ++ show x
66
- elabCon defs " Fail" [_ ,msg]
66
+ elabCon defs " Fail" [_ , mbfc, msg]
67
67
= do msg' <- evalClosure defs msg
68
- throw (GenericMsg fc (" Error during reflection: " ++
68
+ let customFC = case ! (evalClosure defs mbfc >>= reify defs) of
69
+ EmptyFC => fc
70
+ x => x
71
+ throw (GenericMsg customFC (" Error during reflection: " ++
69
72
! (reify defs msg')))
70
73
elabCon defs " LogMsg" [topic, verb, str]
71
74
= do topic' <- evalClosure defs topic
You can’t perform that action at this time.
0 commit comments