feat(frontends/lean/parser): reject explicit universe levels in variables and parameters
This modification was motivated by issue #427
This commit is contained in:
parent
a35cce38b3
commit
04e92e1e96
3 changed files with 11 additions and 1 deletions
|
@ -1079,7 +1079,10 @@ expr parser::id_to_expr(name const & id, pos_info const & p) {
|
|||
|
||||
// locals
|
||||
if (auto it1 = m_local_decls.find(id)) {
|
||||
auto r = copy_with_new_pos(propagate_levels(*it1, ls), p);
|
||||
if (ls && m_undef_id_behavior != undef_id_behavior::AssumeConstant)
|
||||
throw parser_error("invalid use of explicit universe parameter, identifier is a variable, "
|
||||
"parameter or a constant bound to parameters in a section/context", p);
|
||||
auto r = copy_with_new_pos(*it1, p);
|
||||
save_type_info(r);
|
||||
save_identifier_info(p, id);
|
||||
return r;
|
||||
|
|
6
tests/lean/sec3.lean
Normal file
6
tests/lean/sec3.lean
Normal file
|
@ -0,0 +1,6 @@
|
|||
context
|
||||
parameter A : Type
|
||||
definition tst (a : A) := a
|
||||
set_option pp.universes true
|
||||
check tst.{1}
|
||||
end
|
1
tests/lean/sec3.lean.expected.out
Normal file
1
tests/lean/sec3.lean.expected.out
Normal file
|
@ -0,0 +1 @@
|
|||
sec3.lean:5:8: error: invalid use of explicit universe parameter, identifier is a variable, parameter or a constant bound to parameters in a section/context
|
Loading…
Reference in a new issue