diff --git a/lib/vcs/src/dune b/lib/vcs/src/dune index c7c685f..1f985f6 100644 --- a/lib/vcs/src/dune +++ b/lib/vcs/src/dune @@ -17,7 +17,12 @@ (instrumentation (backend bisect_ppx)) (lint - (pps ppx_js_style -allow-let-operators -check-doc-comments)) + (pps + -unused-code-warnings=force + ppx_compare + ppx_js_style + -allow-let-operators + -check-doc-comments)) (modules_without_implementation trait_add trait_branch @@ -38,6 +43,7 @@ (preprocess (pps -unused-code-warnings=force + -no-corrections ppx_enumerate ppx_sexp_conv ppx_sexp_value))) diff --git a/lib/vcs/src/graph.ml b/lib/vcs/src/graph.ml index 78f004d..9cfdd5f 100644 --- a/lib/vcs/src/graph.ml +++ b/lib/vcs/src/graph.ml @@ -48,26 +48,71 @@ module Node_kind = struct } [@@deriving sexp_of] - let equal = - (fun a__001_ b__002_ -> - if a__001_ == b__002_ - then true - else ( - match a__001_, b__002_ with - | Root _a__003_, Root _b__004_ -> Rev.equal _a__003_.rev _b__004_.rev - | Root _, _ -> false - | _, Root _ -> false - | Commit _a__005_, Commit _b__006_ -> - Rev.equal _a__005_.rev _b__006_.rev - && Node.equal _a__005_.parent _b__006_.parent - | Commit _, _ -> false - | _, Commit _ -> false - | Merge _a__007_, Merge _b__008_ -> - Rev.equal _a__007_.rev _b__008_.rev - && Node.equal _a__007_.parent1 _b__008_.parent1 - && Node.equal _a__007_.parent2 _b__008_.parent2) - : t -> t -> bool) - ;; + (* CR mbarbin: This almost works now with [NathanReb/improve-deriving-inline]. + + Building Works! + + {v + $ dune build @all + [0] + v} + + However, the linter shows small mismatch in ocamlformatting. For example, + it wants to add parenthesis around certain tuple below: + + {[ + match (a__001_, b__002_) with + | (Root _a__003_, Root _b__004_) -> Rev.equal _a__003_.rev _b__004_.rev + | (Root _, _) -> false + | (_, Root _) -> false + ]} + *) + + include ( + struct + type nonrec t = t = + | Root of { rev : Rev.t } + | Commit of + { rev : Rev.t + ; parent : Node.t + } + | Merge of + { rev : Rev.t + ; parent1 : Node.t + ; parent2 : Node.t + } + [@@deriving_inline equal] + + let equal = + (fun a__001_ -> + fun b__002_ -> + if Stdlib.( == ) a__001_ b__002_ + then true + else ( + match a__001_, b__002_ with + | Root _a__003_, Root _b__004_ -> Rev.equal _a__003_.rev _b__004_.rev + | Root _, _ -> false + | _, Root _ -> false + | Commit _a__005_, Commit _b__006_ -> + Stdlib.( && ) + (Rev.equal _a__005_.rev _b__006_.rev) + (Node.equal _a__005_.parent _b__006_.parent) + | Commit _, _ -> false + | _, Commit _ -> false + | Merge _a__007_, Merge _b__008_ -> + Stdlib.( && ) + (Rev.equal _a__007_.rev _b__008_.rev) + (Stdlib.( && ) + (Node.equal _a__007_.parent1 _b__008_.parent1) + (Node.equal _a__007_.parent2 _b__008_.parent2))) + : t -> t -> bool) + ;; + + [@@@deriving.end] + end : + sig + val equal : t -> t -> bool + end) end include T