feat(frontends/lean/parser): reject explicit universe levels in variables and parameters

This modification was motivated by issue #427
This commit is contained in:
Leonardo de Moura 2015-02-11 16:25:06 -08:00
parent a35cce38b3
commit 04e92e1e96
3 changed files with 11 additions and 1 deletions

View file

@ -1079,7 +1079,10 @@ expr parser::id_to_expr(name const & id, pos_info const & p) {
// locals // locals
if (auto it1 = m_local_decls.find(id)) { 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_type_info(r);
save_identifier_info(p, id); save_identifier_info(p, id);
return r; return r;

6
tests/lean/sec3.lean Normal file
View file

@ -0,0 +1,6 @@
context
parameter A : Type
definition tst (a : A) := a
set_option pp.universes true
check tst.{1}
end

View 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