File tree 3 files changed +14
-3
lines changed
3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -141,8 +141,9 @@ private def expandFields (structStx : Syntax) (structModifiers : Modifiers) (str
141
141
if structStx[5 ][0 ].isToken ":=" then
142
142
-- https://github.com/leanprover/lean4/issues/5236
143
143
if Linter.getLinterValue Linter.linter.deprecated (← getOptions) then
144
- withRef structStx[0 ] <| withRef structStx[5 ][0 ] <| logWarning <| .tagged ``Linter.deprecatedAttr "\
145
- 'structure ... :=' has been deprecated in favor of 'structure ... where'.\n \
144
+ let cmd := if structStx[0 ].getKind == ``Parser.Command.classTk then "class" else "structure"
145
+ withRef structStx[0 ] <| withRef structStx[5 ][0 ] <| logWarning <| .tagged ``Linter.deprecatedAttr s! "\
146
+ '{ cmd} ... :=' has been deprecated in favor of '{ cmd} ... where'.\n \
146
147
You can disable this warning with 'set_option linter.deprecated false'."
147
148
let fieldBinders := if structStx[5 ].isNone then #[] else structStx[5 ][2 ][0 ].getArgs
148
149
fieldBinders.foldlM (init := #[]) fun (views : Array StructFieldView) fieldBinder => withRef fieldBinder do
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ structure Foo where
53
53
{mk4 mk5 : Nat}
54
54
[mk6 mk7 : Nat]
55
55
56
- class Bar (α : Prop ) := mk ::
56
+ class Bar (α : Prop ) where mk ::
57
57
(foo bar := 1 )
58
58
59
59
class Bar2 (α : Prop ) where
Original file line number Diff line number Diff line change 2
2
# Deprecate `:=` for `inductive` and `structure`
3
3
-/
4
4
5
+ set_option linter.deprecated true
6
+
5
7
/--
6
8
warning: 'inductive ... :=' has been deprecated in favor of 'inductive ... where'.
7
9
You can disable this warning with 'set_option linter.deprecated false'.
@@ -18,3 +20,11 @@ You can disable this warning with 'set_option linter.deprecated false'.
18
20
#guard_msgs in
19
21
structure S :=
20
22
(n : Nat)
23
+
24
+ /--
25
+ warning: 'class ... :=' has been deprecated in favor of 'class ... where'.
26
+ You can disable this warning with 'set_option linter.deprecated false'.
27
+ -/
28
+ #guard_msgs in
29
+ class C :=
30
+ (n : Nat)
You can’t perform that action at this time.
0 commit comments