Skip to content

Commit 65f3a82

Browse files
committed
Merge branch 'coq-8.17' into coq-8.18
2 parents 05cffdf + 8a42c5b commit 65f3a82

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

template-coq/src/g_template_coq.mlg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ END
138138
VERNAC 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 }
144145
END
145146

test-suite/issue1042.v

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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).

0 commit comments

Comments
 (0)