fix(frontends/lean/decl_cmds): modifiers should be after universe parameters

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-07-05 21:49:32 -07:00
parent 55894f01e3
commit b3de4bb061

View file

@ -203,13 +203,22 @@ levels collect_section_levels(level_param_names const & ls, parser & p) {
environment definition_cmd_core(parser & p, bool is_theorem, bool _is_opaque) {
name n = p.check_id_next("invalid declaration, identifier expected");
check_atomic(n);
environment env = p.env();
decl_modifiers modifiers;
name real_n; // real name for this declaration
modifiers.m_is_opaque = _is_opaque;
buffer<name> ls_buffer;
expr type, value;
level_param_names ls;
{
// Parse universe parameters
parser::local_scope scope1(p);
parse_univ_params(p, ls_buffer);
// Parse modifiers
modifiers.parse(p);
if (is_theorem && !modifiers.m_is_opaque)
throw exception("invalid theorem declaration, theorems cannot be transparent");
environment env = p.env();
name real_n; // real name for this declaration
if (modifiers.m_is_private) {
auto env_n = add_private_name(env, n, optional<unsigned>(hash(p.pos().first, p.pos().second)));
env = env_n.first;
@ -218,12 +227,7 @@ environment definition_cmd_core(parser & p, bool is_theorem, bool _is_opaque) {
name const & ns = get_namespace(env);
real_n = ns + n;
}
buffer<name> ls_buffer;
expr type, value;
level_param_names ls;
{
parser::local_scope scope1(p);
parse_univ_params(p, ls_buffer);
if (p.curr_is_token(g_assign)) {
auto pos = p.pos();
p.next();