feat(frontends/lean/decl_cmds): sign an error if "noncomputable" keyword is used in the HoTT library or with non-definitions
This commit is contained in:
parent
8a9f774611
commit
74be3031b1
5 changed files with 8 additions and 0 deletions
|
@ -1070,6 +1070,10 @@ public:
|
|||
m_is_private(is_private), m_is_protected(is_protected), m_is_noncomputable(is_noncomputable),
|
||||
m_pos(p.pos()), m_attributes(kind == Abbreviation || kind == LocalAbbreviation) {
|
||||
lean_assert(!(m_is_private && m_is_protected));
|
||||
if (!is_standard(m_p.env()) && is_noncomputable)
|
||||
throw exception("invalid 'noncomputable' declarations, it can only be used in the standard library");
|
||||
if (kind != Definition && is_noncomputable)
|
||||
throw exception("invalid 'noncomputable' declaration, it can only be used for definitions");
|
||||
}
|
||||
|
||||
environment operator()() {
|
||||
|
|
1
tests/lean/noncomp_hott.hlean
Normal file
1
tests/lean/noncomp_hott.hlean
Normal file
|
@ -0,0 +1 @@
|
|||
noncomputable definition foo := 10
|
1
tests/lean/noncomp_hott.hlean.expected.out
Normal file
1
tests/lean/noncomp_hott.hlean.expected.out
Normal file
|
@ -0,0 +1 @@
|
|||
noncomp_hott.hlean:1:0: error: invalid 'noncomputable' declarations, it can only be used in the standard library
|
1
tests/lean/noncomp_thm.lean
Normal file
1
tests/lean/noncomp_thm.lean
Normal file
|
@ -0,0 +1 @@
|
|||
noncomputable theorem foo : true := trivial
|
1
tests/lean/noncomp_thm.lean.expected.out
Normal file
1
tests/lean/noncomp_thm.lean.expected.out
Normal file
|
@ -0,0 +1 @@
|
|||
noncomp_thm.lean:1:0: error: invalid 'noncomputable' declaration, it can only be used for definitions
|
Loading…
Reference in a new issue