Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ This name should be decided amongst the team before the release.

### Fixed
- [#720](https://github.com/tweag/topiary/pull/720) [#722](https://github.com/tweag/topiary/pull/722) [#723](https://github.com/tweag/topiary/pull/723) [#724](https://github.com/tweag/topiary/pull/724) [#735](https://github.com/tweag/topiary/pull/735)
[#738](https://github.com/tweag/topiary/pull/738) [#739](https://github.com/tweag/topiary/pull/739) Various OCaml improvements
[#738](https://github.com/tweag/topiary/pull/738) [#739](https://github.com/tweag/topiary/pull/739) [#745](https://github.com/tweag/topiary/pull/745) Various OCaml improvements

### Changed
- [#704](https://github.com/tweag/topiary/pull/704) Refactors our postprocessing code to be more versatile.
Expand Down
21 changes: 16 additions & 5 deletions topiary-cli/tests/samples/expected/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,8 @@ let () =

let () =
foo x (fun y ->
zzzzzzzzzz
)
zzzzzzzzzz
)

let foo x = function
| y -> zzzzzzzzzz
Expand All @@ -1206,9 +1206,9 @@ let () =

let () =
foo x (function
| y -> zzzzzzzzzz
| u -> vvvvvvvvv
)
| y -> zzzzzzzzzz
| u -> vvvvvvvvv
)

(* #727 proper formatting of multi-lined typed function argument *)
let foo
Expand Down Expand Up @@ -1241,6 +1241,17 @@ type x = [> `Foo | `Bar]
type x = [< `Foo | `Bar]
type x = {a: int; b: int; c: int}

(* #726 multi-line calls containing functions *)
let _ =
foo
bar
(fun baz ->
baaaaaaz
)
(fun qux ->
quuuuuux
)

(* #659 handling of the `;;` separator *)

let bonjour () = "Bonjour"
Expand Down
11 changes: 11 additions & 0 deletions topiary-cli/tests/samples/input/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,17 @@ type x = [> `Foo | `Bar]
type x = [< `Foo | `Bar]
type x = { a: int; b: int; c: int }

(* #726 multi-line calls containing functions *)
let _ =
foo
bar
(fun baz ->
baaaaaaz
)
(fun qux ->
quuuuuux
)

(* #659 handling of the `;;` separator *)

let bonjour () = "Bonjour"
Expand Down
14 changes: 8 additions & 6 deletions topiary-queries/queries/ocaml.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1157,12 +1157,14 @@
; _before_ the application. This allows the following to be formatted as such:
; let () =
; foo bar (fun x ->
; something horrible onto x
; )
; something horrible onto x
; )
(application_expression
.
(_) @prepend_begin_scope @append_indent_start
(_) @append_indent_start @prepend_begin_scope
(#scope_id! "function_application")
(_) @append_indent_end
.
)
(application_expression
(#scope_id! "function_application")
Expand All @@ -1171,7 +1173,7 @@
(fun_expression)
(function_expression)
]? @do_nothing
) @append_end_scope @append_indent_end
) @append_end_scope
.
)
(application_expression
Expand All @@ -1180,8 +1182,8 @@
[
(fun_expression)
(function_expression)
]
) @prepend_end_scope @prepend_indent_end
] @prepend_end_scope
)
.
)
(application_expression
Expand Down