lean4-htt/tests/elab/eqnOptions.lean
Wojciech Różowski 9aad86a576
feat: allow deprecating options (#13195)
This PR adds support for marking options as deprecated. When a
deprecated option is used via `set_option`, a warning is emitted
(controlled by `linter.deprecated.options`).

An `OptionDeprecation` structure with a required `since` field and an
optional `text?` field is added to `OptionDecl`. Each `set_option`
elaborator (command, term, tactic, grind) calls `checkDeprecatedOption`
to emit warnings. The C++ `register_option` is updated to account for
the new field.

As a first use, `backward.eqns.nonrecursive` and
`backward.eqns.deepRecursiveSplit` are marked deprecated. Continues
earlier work done in #11096.
2026-04-02 14:44:11 +00:00

56 lines
1 KiB
Text

/-! Tests that options affecting equational theorems work as expected. -/
set_option linter.deprecated.options false
namespace Test1
def nonrecfun : Bool → Nat
| false => 0
| true => 0
/--
info: equations:
@[defeq] theorem Test1.nonrecfun.eq_1 : nonrecfun false = 0
@[defeq] theorem Test1.nonrecfun.eq_2 : nonrecfun true = 0
-/
#guard_msgs in
#print equations nonrecfun
end Test1
namespace Test2
set_option backward.eqns.nonrecursive false in
def nonrecfun : Bool → Nat
| false => 0
| true => 0
/--
info: equations:
@[defeq] theorem Test2.nonrecfun.eq_1 : ∀ (x : Bool),
nonrecfun x =
match x with
| false => 0
| true => 0
-/
#guard_msgs in
#print equations nonrecfun
end Test2
namespace Test3
def nonrecfun : Bool → Nat
| false => 0
| true => 0
-- should have no effect
set_option backward.eqns.nonrecursive false
/--
info: equations:
@[defeq] theorem Test3.nonrecfun.eq_1 : nonrecfun false = 0
@[defeq] theorem Test3.nonrecfun.eq_2 : nonrecfun true = 0
-/
#guard_msgs in
#print equations nonrecfun
end Test3