feat(frontends/lean/elaborator): flag expr quotes containing universe params
This commit is contained in:
parent
5d68938a9c
commit
876a2bee46
3 changed files with 17 additions and 4 deletions
|
|
@ -2643,7 +2643,7 @@ expr elaborate_quote(expr e, environment const &env, options const &opts, bool i
|
|||
}
|
||||
return none_expr();
|
||||
});
|
||||
e = Fun(locals, e);
|
||||
e = copy_tag(e, Fun(locals, e));
|
||||
|
||||
metavar_context ctx;
|
||||
local_context lctx;
|
||||
|
|
@ -2651,12 +2651,16 @@ expr elaborate_quote(expr e, environment const &env, options const &opts, bool i
|
|||
e = elab.elaborate(e);
|
||||
e = elab.finalize(e, true, true).first;
|
||||
|
||||
expr body = e;
|
||||
for (unsigned i = 0; i < aqs.size(); i++)
|
||||
body = binding_body(body);
|
||||
|
||||
if (in_pattern) {
|
||||
for (unsigned i = 0; i < aqs.size(); i++)
|
||||
e = binding_body(e);
|
||||
e = instantiate_rev(e, aqs.size(), aqs.data());
|
||||
e = instantiate_rev(body, aqs.size(), aqs.data());
|
||||
e = quote(e);
|
||||
} else {
|
||||
if (has_param_univ(body))
|
||||
throw elaborator_exception(e, "invalid quotation, contains universe parameter");
|
||||
e = mk_quote_core(e, true);
|
||||
expr subst = mk_constant(get_expr_subst_name());
|
||||
for (expr aq : aqs)
|
||||
|
|
|
|||
6
tests/lean/expr_quote.lean
Normal file
6
tests/lean/expr_quote.lean
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
meta def f (α a : expr) := ```(@id %%α %%a)
|
||||
|
||||
meta def f (α a : expr) := ```(@id (%%α : Type 2) %%a)
|
||||
|
||||
set_option pp.universes true
|
||||
print f
|
||||
3
tests/lean/expr_quote.lean.expected.out
Normal file
3
tests/lean/expr_quote.lean.expected.out
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
expr_quote.lean:1:32: error: invalid quotation, contains universe parameter
|
||||
meta def f : expr → expr → expr :=
|
||||
λ (α a : expr), expr.subst (expr.subst ```(λ (_x_1 : Type 2) (_x_2 : _x_1), id.{3} _x_2) α) a
|
||||
Loading…
Add table
Reference in a new issue