Skip to content
Closed
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
8 changes: 7 additions & 1 deletion lib/vcs/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -38,6 +43,7 @@
(preprocess
(pps
-unused-code-warnings=force
-no-corrections
ppx_enumerate
ppx_sexp_conv
ppx_sexp_value)))
85 changes: 65 additions & 20 deletions lib/vcs/src/graph.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading