| /-! | |
| Tests that `deriving` reports deprecated types and classes named in deriving clauses once, at the | |
| name, and does not report the code generated by deriving handlers. | |
| -/ | |
| set_option linter.deprecated true | |
| structure ReplacementStruct where | |
| x : Nat | |
| @[deprecated ReplacementStruct (since := "2025-01-01")] structure DeprecatedStruct where | |
| x : Nat | |
| /-- | |
| warning: `DeprecatedStruct` has been deprecated: Use `ReplacementStruct` instead | |
| Hint: Replace the deprecated name: | |
| D̵e̵p̵r̵e̵c̵a̵t̵e̵d̵S̵t̵r̵u̵c̵t̵R̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲S̲t̲r̲u̲c̲t̲ | |
| -/ | |
| #guard_msgs in | |
| deriving instance Repr for DeprecatedStruct | |
| /-- | |
| warning: `DeprecatedStruct` has been deprecated: Use `ReplacementStruct` instead | |
| Hint: Replace the deprecated name: | |
| D̵e̵p̵r̵e̵c̵a̵t̵e̵d̵S̵t̵r̵u̵c̵t̵R̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲S̲t̲r̲u̲c̲t̲ | |
| -/ | |
| #guard_msgs in | |
| deriving instance BEq, Hashable for DeprecatedStruct | |
| /-- | |
| warning: `DeprecatedStruct` has been deprecated: Use `ReplacementStruct` instead | |
| Hint: Replace the deprecated name: | |
| D̵e̵p̵r̵e̵c̵a̵t̵e̵d̵S̵t̵r̵u̵c̵t̵R̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲S̲t̲r̲u̲c̲t̲ | |
| -/ | |
| #guard_msgs in | |
| deriving instance Inhabited for ReplacementStruct, DeprecatedStruct | |
| -- Deriving instances for the deprecated type in its own declaration is not a use. | |
| #guard_msgs in | |
| @[deprecated ReplacementStruct (since := "2025-01-01")] structure DeprecatedStruct2 where | |
| x : Nat | |
| deriving Repr, BEq, Hashable | |
| #guard_msgs in | |
| @[deprecated ReplacementStruct (since := "2025-01-01")] inductive DeprecatedInductive where | |
| | a | |
| deriving Repr, DecidableEq | |
| -- Types that mention a deprecated type are not reported for the instances derived for them. | |
| /-- | |
| warning: `DeprecatedStruct` has been deprecated: Use `ReplacementStruct` instead | |
| Hint: Replace the deprecated name: | |
| D̵e̵p̵r̵e̵c̵a̵t̵e̵d̵S̵t̵r̵u̵c̵t̵R̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲S̲t̲r̲u̲c̲t̲ | |
| -/ | |
| #guard_msgs in | |
| structure Wrapper where | |
| s : DeprecatedStruct | |
| deriving Repr | |
| @[deprecated ReplacementStruct (since := "2025-01-01")] structure DeprecatedStruct3 where | |
| x : Nat | |
| -- `#eval` derives a `Repr` instance on the fly. | |
| /-- | |
| warning: `DeprecatedStruct3` has been deprecated: Use `ReplacementStruct` instead | |
| Hint: Replace the deprecated name: | |
| D̵e̵p̵r̵e̵c̵a̵t̵e̵d̵S̵t̵r̵u̵c̵t̵3̵R̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲S̲t̲r̲u̲c̲t̲ | |
| --- | |
| info: { x := 1 } | |
| -/ | |
| #guard_msgs in | |
| #eval (⟨1⟩ : DeprecatedStruct3) | |
| /-! Delta deriving for definitions -/ | |
| def ReplacementTypeDef := Nat | |
| @[deprecated ReplacementTypeDef (since := "2025-01-01")] def DeprecatedTypeDef := Nat | |
| /-- | |
| warning: `DeprecatedTypeDef` has been deprecated: Use `ReplacementTypeDef` instead | |
| Hint: Replace the deprecated name: | |
| D̵e̵p̵r̵e̵c̵a̵t̵e̵d̵T̵y̵p̵e̵D̵e̵f̵R̲e̲p̲l̲a̲c̲e̲m̲e̲n̲t̲T̲y̲p̲e̲D̲e̲f̲ | |
| -/ | |
| #guard_msgs in | |
| deriving instance Inhabited for DeprecatedTypeDef | |
| #guard_msgs in | |
| @[deprecated ReplacementTypeDef (since := "2025-01-01")] def DeprecatedTypeDef2 := Nat | |
| deriving Inhabited | |
| /-! Deprecated classes -/ | |
| @[deprecated Repr (since := "2025-01-01")] abbrev DeprecatedClass := Repr | |
| structure DerivingTarget where | |
| x : Nat | |
| /-- | |
| warning: `DeprecatedClass` has been deprecated: Use `Repr` instead | |
| Hint: Replace the deprecated name: | |
| D̵e̵p̵r̵e̵c̵a̵t̵e̵d̵C̵l̵a̵s̵s̵R̲e̲p̲r̲ | |
| --- | |
| error: No deriving handlers have been implemented for class `DeprecatedClass` | |
| -/ | |
| #guard_msgs in | |
| deriving instance DeprecatedClass for DerivingTarget | |
| /-- | |
| warning: `DeprecatedClass` has been deprecated: Use `Repr` instead | |
| Hint: Replace the deprecated name: | |
| D̵e̵p̵r̵e̵c̵a̵t̵e̵d̵C̵l̵a̵s̵s̵R̲e̲p̲r̲ | |
| --- | |
| error: No deriving handlers have been implemented for class `DeprecatedClass` | |
| -/ | |
| #guard_msgs in | |
| structure DerivingTarget2 where | |
| x : Nat | |
| deriving DeprecatedClass |