Skip to content

Commit

Permalink
Show the location in terminal when the unknown object exception is ca…
Browse files Browse the repository at this point in the history
…tched by the scope_term function
  • Loading branch information
Alidra committed Apr 9, 2024
1 parent f9689ac commit bdf3828
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/parsing/scope.ml
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,15 @@ let scope_term :
?find_sym:find_sym -> ?typ:bool -> ?mok:(int -> meta option)
-> bool -> sig_state -> env -> p_term -> term =
fun ?find_sym ?(typ=false) ?(mok=fun _ -> None) m_term_prv ss env t ->
let md = M_Term {m_term_meta_of_key=mok; m_term_prv} in
Bindlib.unbox (scope ?find_sym ~typ 0 md ss env t)
try
let md = M_Term {m_term_meta_of_key=mok; m_term_prv} in
Bindlib.unbox (scope ?find_sym ~typ 0 md ss env t)
with Fatal(Some p, msg) ->
Console.out 3 (Color.red "%a") Pos.pp p;
(** Get ride of the position because the error message is displayed here
There is no more need of the position and this avoids the message
to be displayed twice in [Error.handle_exceptions] *)
raise(Fatal(None, msg))

(** [scope_search_pattern ~find_sym ~typ prv ss env t] turns a pterm [t] meant
to be a search patter into a term in the signature state [ss]
Expand Down

0 comments on commit bdf3828

Please sign in to comment.