lean4-htt/tests/lean/deprecated.lean
Mario Carneiro 4f664fb3b5
feat: improve @[deprecated] attr (#3968)
Complement to #3967 , adds a `(since := "<date>")` field to
`@[deprecated]` so that metaprogramming code has access to the
deprecation date for e.g. bulk removals. Also adds `@[deprecated
"deprecation message"]` to optionally replace the default text
"`{declName}` has been deprecated, use `{newName}` instead".
2024-04-23 17:00:32 +00:00

33 lines
523 B
Text

set_option linter.deprecated true
def g (x : Nat) := x + 1
@[deprecated g]
def f (x : Nat) := x + 1
@[deprecated]
def h (x : Nat) := x + 1
#eval f 0 + 1
#eval h 0
@[deprecated g1]
def f1 (x : Nat) := x + 1
def Foo.g1 := 10
@[deprecated Foo.g1 (since := "2022-07-24")]
def f2 (x : Nat) := x + 1
@[deprecated g1]
def f3 (x : Nat) := x + 1
open Foo
@[deprecated g1 "use g1 instead, f4 is not a good name"]
def f4 (x : Nat) := x + 1
#eval f2 0 + 1
set_option linter.deprecated false in
#eval f2 0 + 1
#eval f4 0 + 1