chore(library/kernel_serializer): add assertions for invalid uses of anonymous names

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-08-07 08:26:45 -07:00
parent 955d7d2659
commit 6d6c62461f

View file

@ -159,6 +159,7 @@ class expr_serializer : public object_serializer<expr, expr_hash_alloc, expr_eqp
s << var_idx(a); s << var_idx(a);
break; break;
case expr_kind::Constant: case expr_kind::Constant:
lean_assert(!const_name(a).is_anonymous());
s << const_name(a) << const_levels(a); s << const_name(a) << const_levels(a);
break; break;
case expr_kind::Sort: case expr_kind::Sort:
@ -175,13 +176,17 @@ class expr_serializer : public object_serializer<expr, expr_hash_alloc, expr_eqp
write_core(app_fn(a)); write_core(app_arg(a)); write_core(app_fn(a)); write_core(app_arg(a));
break; break;
case expr_kind::Lambda: case expr_kind::Pi: case expr_kind::Lambda: case expr_kind::Pi:
lean_assert(!binding_name(a).is_anonymous());
write_binder_name(s, binding_name(a)); write_binder_name(s, binding_name(a));
s << binding_info(a); write_core(binding_domain(a)); write_core(binding_body(a)); s << binding_info(a); write_core(binding_domain(a)); write_core(binding_body(a));
break; break;
case expr_kind::Meta: case expr_kind::Meta:
lean_assert(!mlocal_name(a).is_anonymous());
s << mlocal_name(a); write_core(mlocal_type(a)); s << mlocal_name(a); write_core(mlocal_type(a));
break; break;
case expr_kind::Local: case expr_kind::Local:
lean_assert(!mlocal_name(a).is_anonymous());
lean_assert(!local_pp_name(a).is_anonymous());
s << mlocal_name(a) << local_pp_name(a) << local_info(a); write_core(mlocal_type(a)); s << mlocal_name(a) << local_pp_name(a) << local_info(a); write_core(mlocal_type(a));
break; break;
} }