File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 138138VERNAC COMMAND EXTEND TemplateCoq_Run_Template_Program CLASSIFIED AS SIDEFF STATE program
139139 | #[ poly = polymorphic ] [ "MetaCoq" "Run" constr(def) ] ->
140140 { fun ~pm -> let (env, evm) = fresh_env () in
141- let (evm, def) = Constrintern.interp_open_constr env evm def in
142- let pgm = to_constr_evars evm def in
141+ let (pgm, ctx) = Constrintern.interp_constr env evm def in
142+ let evm = Evd.from_ctx ctx in
143+ let pgm = EConstr.to_constr ~abort_on_undefined_evars:true evm pgm in
143144 run_template_program ~pm env evm ~poly pgm }
144145END
145146
Original file line number Diff line number Diff line change 1+ From MetaCoq.Utils Require Import utils.
2+ From MetaCoq.Template Require Import All .
3+ Import MCMonadNotation.
4+
5+
6+ (*Exemple with a typing error *)
7+ Definition ident_term (a : term) : term := a.
8+
9+ Definition quote_inductive {X}(inductive:X): TemplateMonad _ :=
10+ quote <- tmQuote inductive;;
11+ tmReturn quote.
12+
13+ Inductive tm : Set := .
14+
15+ Definition d1 : TemplateMonad unit.
16+ (* Set Debug "backtrace". *)
17+ Fail MetaCoq Run(
18+ quote <- quote_inductive tm;;
19+ constructor <- ident_term quote;;
20+ tmPrint constructor)
21+ .
22+ Fail run_template_program (quote <- quote_inductive tm;;
23+ constructor <- ident_term quote;;
24+ tmPrint constructor) ltac:(fun x => idtac).
25+ Fail refine (
26+ quote <- quote_inductive tm;;
27+ constructor <- ident_term quote;;
28+ tmPrint constructor).
You can’t perform that action at this time.
0 commit comments