@@ -1023,3 +1023,52 @@ info: @add_comm_alias : ∀ {G : Type u_1} [inst : AddCommMagma G] (a b : G), a
10231023-/
10241024#guard_msgs in
10251025#check @add_comm_alias
1026+
1027+ /-! Warning when adding docstrings to existing declarations -/
1028+
1029+ namespace ExistingDeclDocstring
1030+
1031+ /-- Existing docstring -/
1032+ opaque add (G : Type *) [AddGroup G] : Prop
1033+
1034+ /-- warning: The target declaration `add` already has a docstring. -/
1035+ #guard_msgs in
1036+ @ [to_additive existing /-- New docstring -/ ]
1037+ opaque mul (G : Type *) [Group G] : Prop
1038+
1039+ /-- warning: The target declaration `self` already has a docstring. -/
1040+ #guard_msgs in
1041+ /-- Existing docstring -/
1042+ @ [to_additive self (reorder := x y) /-- New docstring -/ ]
1043+ opaque self (x y : Nat) : Prop
1044+
1045+ /-- Existing docstring -/
1046+ structure addStruct (G : Type *) [AddGroup G] where
1047+
1048+ /-- warning: The target declaration `addStruct` already has a docstring. -/
1049+ #guard_msgs in
1050+ @ [to_additive /-- New docstring -/ ]
1051+ structure mulStruct (G : Type *) [Group G] where
1052+
1053+ -- Examples with no pre-existing docstring
1054+
1055+ opaque add' (G : Type *) [AddGroup G] : Prop
1056+
1057+ /-- warning: This docstring should be added directly to `add'`. -/
1058+ #guard_msgs in
1059+ @ [to_additive existing /-- New docstring -/ ]
1060+ opaque mul' (G : Type *) [Group G] : Prop
1061+
1062+ /-- warning: This docstring should be added directly to `self'`. -/
1063+ #guard_msgs in
1064+ @ [to_additive self (reorder := x y) /-- New docstring -/ ]
1065+ opaque self' (x y : Nat) : Prop
1066+
1067+ structure addStruct' (G : Type *) [AddGroup G] where
1068+
1069+ /-- warning: This docstring should be added directly to `addStruct'`. -/
1070+ #guard_msgs in
1071+ @ [to_additive /-- New docstring -/ ]
1072+ structure mulStruct' (G : Type *) [Group G] where
1073+
1074+ end ExistingDeclDocstring
0 commit comments