forked from ocaml-ppx/ocamlformat
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add comments explaining moving comments tests.
Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>
- Loading branch information
1 parent
2526cf1
commit 10ef9f6
Showing
3 changed files
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,20 @@ | ||
(* This comment moves for similar reason to existing behavior as shown below. | ||
In particular, the operator ([@@] / [->]) does not carry a source locaion, | ||
and the comment attaches to the location of the identifier on the right side | ||
of the operator rather than the left due to the parenthesis. Fixing this would | ||
require messing with the comment association logic, which is difficult. *) | ||
type t = A of t1 @@ m1 m2 * t2 @@ m3 m4 * (t3 @ m5 -> t4 @ m6) (* cmt *) @@ m7 m8 | ||
type t = A of (t -> u) (* cmt *) @@ m | ||
type t = A of ((t -> u) (* cmt *) -> m) | ||
|
||
(* This comment attaches to the [f]; the syntax [(f @ mode1)] doesn't have its own | ||
location to latch onto. This seems like a rare position to put a comment, so it doesn't | ||
seem worth changing the parser to be able to differentiate the following two. *) | ||
let (* cmt *) (f @ mode1) (arg1 @ mode2) (arg2 @ mode3) : typ = x | ||
let (* cmt *) (f @ mode) arg = x | ||
let ((* cmt *) f @ mode) arg = x | ||
|
||
(* This comment moves due to existing behavior as shown below. *) | ||
let (f @ mode1) (arg1 @ mode2) (arg2 @ mode3) (* cmt *) : typ = x | ||
let f (arg @ mode) (* cmt *) : typ = x | ||
let f (arg : typ) (* cmt *) : typ = x |
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 |
---|---|---|
@@ -1,4 +1,20 @@ | ||
(* This comment moves for similar reason to existing behavior as shown below. | ||
In particular, the operator ([@@] / [->]) does not carry a source locaion, | ||
and the comment attaches to the location of the identifier on the right side | ||
of the operator rather than the left due to the parenthesis. Fixing this would | ||
require messing with the comment association logic, which is difficult. *) | ||
type t = A of t1 @@ m1 m2 * t2 @@ m3 m4 * (t3 @ m5 -> t4 @ m6) @@ (* cmt *) m7 m8 | ||
type t = A of (t -> u) @@ (* cmt *) m | ||
type t = A of ((t -> u) -> (* cmt *) m) | ||
|
||
(* This comment attaches to the [f]; the syntax [(f @ mode1)] doesn't have its own | ||
location to latch onto. This seems like a rare position to put a comment, so it doesn't | ||
seem worth changing the parser to be able to differentiate the following two. *) | ||
let ((* cmt *) f @ mode1) (arg1 @ mode2) (arg2 @ mode3) : typ = x | ||
let ((* cmt *) f @ mode) arg = x | ||
let ((* cmt *) f @ mode) arg = x | ||
|
||
(* This comment moves due to existing behavior as shown below. *) | ||
let (f @ mode1) (arg1 @ mode2) (arg2 @ mode3) : typ = (* cmt *) x | ||
let f (arg @ mode) : typ = (* cmt *) x | ||
let f (arg : typ) : typ = (* cmt *) x |
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 |
---|---|---|
@@ -1,6 +1,29 @@ | ||
(* This comment moves for similar reason to existing behavior as shown below. | ||
In particular, the operator ([@@] / [->]) does not carry a source locaion, | ||
and the comment attaches to the location of the identifier on the right | ||
side of the operator rather than the left due to the parenthesis. Fixing | ||
this would require messing with the comment association logic, which is | ||
difficult. *) | ||
type t = | ||
| A of t1 @@ m1 m2 * t2 @@ m3 m4 * (t3 @ m5 -> t4 @ m6) @@ (* cmt *) m7 m8 | ||
|
||
type t = A of (t -> u) @@ (* cmt *) m | ||
|
||
type t = A of ((t -> u) -> (* cmt *) m) | ||
|
||
(* This comment attaches to the [f]; the syntax [(f @ mode1)] doesn't have | ||
its own location to latch onto. This seems like a rare position to put a | ||
comment, so it doesn't seem worth changing the parser to be able to | ||
differentiate the following two. *) | ||
let ((* cmt *) f @ mode1) (arg1 @ mode2) (arg2 @ mode3) : typ = x | ||
|
||
let ((* cmt *) f @ mode) arg = x | ||
|
||
let ((* cmt *) f @ mode) arg = x | ||
|
||
(* This comment moves due to existing behavior as shown below. *) | ||
let (f @ mode1) (arg1 @ mode2) (arg2 @ mode3) : typ = (* cmt *) x | ||
|
||
let f (arg @ mode) : typ = (* cmt *) x | ||
|
||
let f (arg : typ) : typ = (* cmt *) x |