blob: 604323f62867de8f0d385254cda205e71d0ed50a [file]
import Lean
/-!
Tests that attributes taking the name of a declaration (`implemented_by`, `init`, `inherit_doc`,
`app_unexpander`, `app_delab`, and `delab app.c`) and the `attribute` command report deprecated
declarations.
-/
set_option linter.deprecated true
/-- Replacement docs. -/
def replacementDef (n : Nat) : Nat := n + 1
/-- Deprecated docs. -/
@[deprecated replacementDef (since := "2025-01-01")] def deprecatedDef (n : Nat) : Nat := n + 1
theorem replacementThm (n : Nat) : replacementDef n = n + 1 := rfl
@[deprecated replacementThm (since := "2025-01-01")]
theorem deprecatedThm (n : Nat) : replacementDef n = n + 1 := rfl
/--
warning: `deprecatedDef` has been deprecated: Use `replacementDef` instead
Hint: Replace the deprecated name:
d̵e̵p̵r̵e̵c̵a̵t̵e̵d̵D̵e̵f̵r̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲D̲e̲f̲
-/
#guard_msgs in
@[implemented_by deprecatedDef] def implementedDef (n : Nat) : Nat := n + 1
def replacementInitDef : IO Unit := pure ()
@[deprecated replacementInitDef (since := "2025-01-01")] def deprecatedInitDef : IO Unit := pure ()
/--
warning: `deprecatedInitDef` has been deprecated: Use `replacementInitDef` instead
Hint: Replace the deprecated name:
d̵e̵p̵r̵e̵c̵a̵t̵e̵d̵I̵n̵i̵t̵D̵e̵f̵r̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲I̲n̲i̲t̲D̲e̲f̲
-/
#guard_msgs in
@[init deprecatedInitDef] opaque initializedDef : Unit
/--
warning: `deprecatedDef` has been deprecated: Use `replacementDef` instead
Hint: Replace the deprecated name:
d̵e̵p̵r̵e̵c̵a̵t̵e̵d̵D̵e̵f̵r̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲D̲e̲f̲
-/
#guard_msgs in
@[inherit_doc deprecatedDef] def inheritingDef : Nat := 1
/--
warning: `deprecatedDef` has been deprecated: Use `replacementDef` instead
Hint: Replace the deprecated name:
d̵e̵p̵r̵e̵c̵a̵t̵e̵d̵D̵e̵f̵r̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲D̲e̲f̲
-/
#guard_msgs in
open Lean PrettyPrinter in
@[app_unexpander deprecatedDef] meta def unexpandDeprecatedDef : Unexpander := fun _ => throw ()
/--
warning: `deprecatedDef` has been deprecated: Use `replacementDef` instead
Hint: Replace the deprecated name:
d̵e̵p̵r̵e̵c̵a̵t̵e̵d̵D̵e̵f̵r̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲D̲e̲f̲
-/
#guard_msgs in
open Lean PrettyPrinter Delaborator in
@[app_delab deprecatedDef] meta def appDelabDeprecatedDef : Delab := failure
/--
warning: `deprecatedDef` has been deprecated: Use `replacementDef` instead
Hint: Replace the deprecated name:
d̵e̵p̵r̵e̵c̵a̵t̵e̵d̵D̵e̵f̵r̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲D̲e̲f̲
-/
#guard_msgs in
open Lean PrettyPrinter Delaborator in
@[delab app.deprecatedDef] meta def delabDeprecatedDef : Delab := failure
/-! The `attribute` command -/
/--
warning: `deprecatedDef` has been deprecated: Use `replacementDef` instead
Hint: Replace the deprecated name:
d̵e̵p̵r̵e̵c̵a̵t̵e̵d̵D̵e̵f̵r̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲D̲e̲f̲
-/
#guard_msgs in
attribute [inline] deprecatedDef
-- Only erasing attributes is not reported.
/-- warning: `deprecatedThm` does not have the `[simp]` attribute -/
#guard_msgs in
attribute [-simp] deprecatedThm
-- Non-deprecated declarations are not reported.
#guard_msgs in
@[implemented_by replacementDef] def implementedDef' (n : Nat) : Nat := n + 1
-- The unexpander generated by `notation` is not reported, only the quotation of the right-hand side.
/--
warning: `deprecatedDef` has been deprecated: Use `replacementDef` instead
Hint: Replace the deprecated name:
d̵e̵p̵r̵e̵c̵a̵t̵e̵d̵D̵e̵f̵r̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲D̲e̲f̲
-/
#guard_msgs in
notation "notationDeprecated" => deprecatedDef