feat(frontends/lean/structure_cmd): mark structure as 'class' when [class] modifier is used
This commit is contained in:
parent
b112f3c582
commit
9531203d9d
3 changed files with 14 additions and 0 deletions
|
@ -35,6 +35,7 @@ Author: Leonardo de Moura
|
|||
#include "frontends/lean/tokens.h"
|
||||
#include "frontends/lean/elaborator_exception.h"
|
||||
#include "frontends/lean/type_util.h"
|
||||
#include "frontends/lean/class.h"
|
||||
|
||||
namespace lean {
|
||||
static name * g_tmp_prefix = nullptr;
|
||||
|
@ -558,6 +559,8 @@ struct structure_cmd_fn {
|
|||
add_alias(m_name, false);
|
||||
add_alias(m_mk);
|
||||
add_rec_alias(rec_name);
|
||||
if (m_modifiers.is_class())
|
||||
m_env = add_class(m_env, m_name);
|
||||
}
|
||||
|
||||
void save_def_info(name const & n) {
|
||||
|
|
9
tests/lean/struct_class.lean
Normal file
9
tests/lean/struct_class.lean
Normal file
|
@ -0,0 +1,9 @@
|
|||
structure point [class] (A : Type) (B : Type) :=
|
||||
mk :: (x : A) (y : B)
|
||||
|
||||
print classes
|
||||
|
||||
structure point2 (A : Type) (B : Type) :=
|
||||
mk :: (x : A) (y : B)
|
||||
|
||||
print classes
|
2
tests/lean/struct_class.lean.expected.out
Normal file
2
tests/lean/struct_class.lean.expected.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
point : Type → Type → Type
|
||||
point : Type → Type → Type
|
Loading…
Reference in a new issue