forked from ocaml-ppx/ocamlformat
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix formatting of attributes on long lines (#86)
* add test of status quo Signed-off-by: David Vulakh <[email protected]> * add back break that was removed "for ocp compat" Signed-off-by: David Vulakh <[email protected]> * fix or-patterns Signed-off-by: David Vulakh <[email protected]> --------- Signed-off-by: David Vulakh <[email protected]>
- Loading branch information
Showing
21 changed files
with
333 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
(* This is a separate test from [attributes.ml] because we want to be able to see the | ||
output on the [janestreet] profile. *) | ||
|
||
let _ = | ||
very_long_function_name_that_causes_the_line_to_wrap_at_some_point [@alert | ||
"-turn-it-off"] | ||
;; | ||
|
||
let () = | ||
(f (fun () -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) [@aaaaaa | ||
"This \ | ||
formatting \ | ||
is \ | ||
a \ | ||
bit \ | ||
strange"]) | ||
;; | ||
|
||
let f = function | ||
| A (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ||
| (B | C _) [@alert "-foo"] | ||
-> 0 | ||
| D -> 0 | ||
;; | ||
|
||
(* Meanwhile, these are fine *) | ||
let f = function | ||
| A (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ((C _) [@alert "-foo"]) | ||
-> 0 | ||
| B | D -> 0 | ||
;; | ||
|
||
let f = function | ||
| (B | C _) [@alert "-foo"] | A (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ||
-> 0 | ||
| D -> 0 | ||
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warning: tests/attribute_on_long_line.ml:9 exceeds the margin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
(* This is a separate test from [attributes.ml] because we want to be able to see the | ||
output on the [janestreet] profile. *) | ||
|
||
let _ = | ||
very_long_function_name_that_causes_the_line_to_wrap_at_some_point | ||
[@alert "-turn-it-off"] | ||
;; | ||
|
||
let () = | ||
(f (fun () -> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) | ||
[@aaaaaa "This formatting is a bit strange"]) | ||
;; | ||
|
||
let f = function | ||
| A (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ||
| (B | C _) [@alert "-foo"] -> 0 | ||
| D -> 0 | ||
;; | ||
|
||
(* Meanwhile, these are fine *) | ||
let f = function | ||
| A (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ((C _) [@alert "-foo"]) | ||
-> 0 | ||
| B | D -> 0 | ||
;; | ||
|
||
let f = function | ||
| (B | C _) [@alert "-foo"] | A (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ||
-> 0 | ||
| D -> 0 | ||
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(* This is a separate test from [attributes.ml] because we want to be able to | ||
see the output on the [janestreet] profile. *) | ||
|
||
let _ = | ||
very_long_function_name_that_causes_the_line_to_wrap_at_some_point | ||
[@alert "-turn-it-off"] | ||
|
||
let () = | ||
(f (fun () -> | ||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ) | ||
[@aaaaaa "This formatting is a bit strange"] ) | ||
|
||
let f = function | ||
| A (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ||
|(B | C _) [@alert "-foo"] -> | ||
0 | ||
| D -> 0 | ||
|
||
(* Meanwhile, these are fine *) | ||
let f = function | ||
| A (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ||
|((C _) [@alert "-foo"]) -> | ||
0 | ||
| B | D -> 0 | ||
|
||
let f = function | ||
| (B | C _) [@alert "-foo"] | ||
|A (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) -> | ||
0 | ||
| D -> 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.