File tree Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ profile. This started with version 0.26.0.
44
44
- Fix position of comments around and within ` (type ...) ` function arguments (#2503 , @gpetiot )
45
45
- Fix missing parentheses around constraint expressions with attributes (#2513 , @alanechang )
46
46
- Fix formatting of type vars in GADT constructors (#2518 , @Julow )
47
+ - Fix ` [@ocamlformat "disable"] ` inside ` class type ` constructs. (#2525 , @EmileTrotignon )
47
48
48
49
## 0.26.1 (2023-09-15)
49
50
Original file line number Diff line number Diff line change @@ -178,6 +178,10 @@ let update_config_maybe_disabled c loc l f =
178
178
let c = update_config c l in
179
179
maybe_disabled c loc l f
180
180
181
+ let update_config_maybe_disabled_k c loc l ~if_disabled enabled =
182
+ let c = update_config c l in
183
+ maybe_disabled_k c loc l enabled if_disabled
184
+
181
185
let update_config_maybe_disabled_attrs c loc attrs f =
182
186
let l = attrs.attrs_before @ attrs.attrs_after in
183
187
update_config_maybe_disabled c loc l f
@@ -2874,7 +2878,8 @@ and fmt_class_type ?(pro = noop) c ({ast= typ; _} as xtyp) =
2874
2878
protect c (Cty typ)
2875
2879
@@
2876
2880
let {pcty_desc; pcty_loc; pcty_attributes} = typ in
2877
- update_config_maybe_disabled c pcty_loc pcty_attributes
2881
+ update_config_maybe_disabled_k c pcty_loc pcty_attributes
2882
+ ~if_disabled: (fun fmt -> vbox 2 (pro $ fmt) )
2878
2883
@@ fun c ->
2879
2884
let doc, atrs = doc_atrs pcty_attributes in
2880
2885
let parens = parenze_cty xtyp in
Original file line number Diff line number Diff line change 1328
1328
(package ocamlformat)
1329
1329
(action (diff tests/ disable_attr.ml.err disable_attr.ml.stderr)))
1330
1330
1331
+ (rule
1332
+ (deps tests/ .ocamlformat )
1333
+ (package ocamlformat)
1334
+ (action
1335
+ (with- stdout- to disable_class_type.ml.stdout
1336
+ (with- stderr- to disable_class_type.ml.stderr
1337
+ (run % {bin: ocamlformat} -- margin- check % {dep: tests/ disable_class_type.ml})))))
1338
+
1339
+ (rule
1340
+ (alias runtest)
1341
+ (package ocamlformat)
1342
+ (action (diff tests/ disable_class_type.ml disable_class_type.ml.stdout)))
1343
+
1344
+ (rule
1345
+ (alias runtest)
1346
+ (package ocamlformat)
1347
+ (action (diff tests/ disable_class_type.ml.err disable_class_type.ml.stderr)))
1348
+
1331
1349
(rule
1332
1350
(deps tests/ .ocamlformat )
1333
1351
(package ocamlformat)
Original file line number Diff line number Diff line change
1
+ class type c =
2
+ let open [@ocamlformat "disable" ] Z
3
+ in
4
+ z
5
+
6
+ class type c =
7
+ object [@ ocamlformat " disable" ]
8
+ end
You can’t perform that action at this time.
0 commit comments