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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ This name should be decided amongst the team before the release.
- [#705](https://github.com/tweag/topiary/pull/705) Added support for Nickel 1.7 extended pattern formatting

### 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) Various OCaml improvements
- [#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) Various OCaml improvements

### Changed
- [#704](https://github.com/tweag/topiary/pull/704) Refactors our postprocessing code to be more versatile.
Expand Down
74 changes: 42 additions & 32 deletions topiary-cli/tests/samples/expected/ocaml-interface.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2181,8 +2181,10 @@ module Tx_rollup_commitment : sig
val check_message_result :
context ->
Compact.t ->
[`Hash of Tx_rollup_message_result_hash.t
| `Result of Tx_rollup_message_result.t] ->
[
| `Hash of Tx_rollup_message_result_hash.t
| `Result of Tx_rollup_message_result.t
] ->
path: Merkle.path ->
index: int ->
context tzresult
Expand Down Expand Up @@ -2344,8 +2346,10 @@ module Tx_rollup_errors : sig
{
provided: Tx_rollup_message_result_hash.t;
expected:
[`Valid_path of Tx_rollup_commitment.Merkle.h * int
| `Hash of Tx_rollup_message_result_hash.t];
[
| `Valid_path of Tx_rollup_commitment.Merkle.h * int
| `Hash of Tx_rollup_message_result_hash.t
];
}
| Proof_undecodable
| Proof_failed_to_reject
Expand Down Expand Up @@ -5347,34 +5351,40 @@ end

(** This module re-exports definitions from {!Token}. *)
module Token : sig
type container = [`Contract of Contract.t
| `Collected_commitments of Blinded_public_key_hash.t
| `Delegate_balance of public_key_hash
| `Frozen_deposits of public_key_hash
| `Block_fees
| `Frozen_bonds of Contract.t * Bond_id.t]

type source = [`Invoice
| `Bootstrap
| `Initial_commitments
| `Revelation_rewards
| `Double_signing_evidence_rewards
| `Endorsing_rewards
| `Baking_rewards
| `Baking_bonuses
| `Minted
| `Liquidity_baking_subsidies
| `Tx_rollup_rejection_rewards
| `Sc_rollup_refutation_rewards
| container]

type sink = [`Storage_fees
| `Double_signing_punishments
| `Lost_endorsing_rewards of public_key_hash * bool * bool
| `Burned
| `Tx_rollup_rejection_punishments
| `Sc_rollup_refutation_punishments
| container]
type container = [
| `Contract of Contract.t
| `Collected_commitments of Blinded_public_key_hash.t
| `Delegate_balance of public_key_hash
| `Frozen_deposits of public_key_hash
| `Block_fees
| `Frozen_bonds of Contract.t * Bond_id.t
]

type source = [
| `Invoice
| `Bootstrap
| `Initial_commitments
| `Revelation_rewards
| `Double_signing_evidence_rewards
| `Endorsing_rewards
| `Baking_rewards
| `Baking_bonuses
| `Minted
| `Liquidity_baking_subsidies
| `Tx_rollup_rejection_rewards
| `Sc_rollup_refutation_rewards
| container
]

type sink = [
| `Storage_fees
| `Double_signing_punishments
| `Lost_endorsing_rewards of public_key_hash * bool * bool
| `Burned
| `Tx_rollup_rejection_punishments
| `Sc_rollup_refutation_punishments
| container
]

val allocated : context -> container -> (context * bool) tzresult Lwt.t

Expand Down
130 changes: 74 additions & 56 deletions topiary-cli/tests/samples/expected/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -620,25 +620,22 @@ let large_const =
->
val

let [a; _; _] =
[
1;
2;
3
]

let [|a; _; _|] =
[|
1;
2;
3
|]

let _ =
(
let x = 42 in
x
)
let [a; _; _] = [
1;
2;
3
]

let [|a; _; _|] = [|
1;
2;
3
|]

let _ = (
let x = 42 in
x
)

let _ =
let foo = fun x ->
Expand Down Expand Up @@ -690,10 +687,9 @@ and quoted_string_multiline_with_id =
World
{|!|}
|external}
let _ =
{
my_string = quoted_string ^ quoted_string_multiline_with_id
}
let _ = {
my_string = quoted_string ^ quoted_string_multiline_with_id
}

(* Tags in pattern matching *)
type my_box = [`Foo of int | `Bar of int]
Expand Down Expand Up @@ -850,12 +846,11 @@ type t = {
(** Boolean flags. *)
}

let _ =
{
verbose = 0;
loggers = "foo";
bflags = StrMap.empty
}
let _ = {
verbose = 0;
loggers = "foo";
bflags = StrMap.empty
}

type t = {
foo: bool; [@default false]
Expand Down Expand Up @@ -896,13 +891,12 @@ type message = {
payload: bytes;
}

let _ =
{
bar = 0.0;
foo = True
[@some tag]
[@some other_tag]
}
let _ = {
bar = 0.0;
foo = True
[@some tag]
[@some other_tag]
}

type controller =
| C : Slug.t -> controller
Expand All @@ -914,22 +908,20 @@ let _ =
let foo : #x y z = bar

(* Playing with nested structures *)
let _ =
(
1,
2,
3,
4
)

let _ =
(
1,
2,
(3, 4),
5,
6
)
let _ = (
1,
2,
3,
4
)

let _ = (
1,
2,
(3, 4),
5,
6
)

let x =
foo
Expand All @@ -943,10 +935,9 @@ let x =
bar;
bar

let _ =
{
foo = let bar = baz in bar
}
let _ = {
foo = let bar = baz in bar
}

(* #618: spacing/softlines in local opens *)
let _ =
Expand Down Expand Up @@ -1252,3 +1243,30 @@ let topiary _x = "Topiary"

print_string (topiary 27);
print_endline "!"

(* #730 consistency of opening brackets dangling *)
let foo = [|
1;
2;
3;
|]
let foo = [
1;
2;
3;
]
let foo = {
a = 1;
b = 2;
c = 3;
}
type bar = [
| `A
| `B
| `C
]
type bar = {
a: int;
b: int;
c: int;
}
27 changes: 27 additions & 0 deletions topiary-cli/tests/samples/input/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1184,3 +1184,30 @@ let topiary _x = "Topiary"

print_string (topiary 27);
print_endline "!"

(* #730 consistency of opening brackets dangling *)
let foo = [|
1;
2;
3;
|]
let foo = [
1;
2;
3;
]
let foo = {
a = 1;
b = 2;
c = 3;
}
type bar = [
| `A
| `B
| `C
]
type bar = {
a: int;
b: int;
c: int;
}
Loading