Skip to content

Commit a02920b

Browse files
committed
Steps to trigger some build issues related to deriving_inline
1 parent 593e9de commit a02920b

File tree

2 files changed

+81
-2
lines changed

2 files changed

+81
-2
lines changed

lib/vcs/src/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
(preprocess
4242
(pps
4343
-unused-code-warnings=force
44+
ppx_compare
4445
ppx_enumerate
4546
ppx_sexp_conv
4647
ppx_sexp_value)))

lib/vcs/src/graph.ml

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,63 @@ module Node_kind = struct
6060

6161
include (
6262
struct
63+
(* CR mbarbin: Here is a sequence that produces some issue for me:
64+
65+
1, Starting from a build in watch mode: `dune build @all @lint -w`
66+
67+
2. After everything stabilizes, I get the "Success, waiting for
68+
filesystem changes..." output from dune.
69+
70+
Then I try the following:
71+
72+
3. Replace the `@@deriving` by a `@@deriving_inline`, and add an additional
73+
line after it: `[@@@deriving.end]`.
74+
75+
4. Save the file.
76+
77+
This triggers a rebuild, and a promotion error that shows the code to be inserted.
78+
79+
5. I run: `dune promote`.
80+
81+
This creates the following error:
82+
83+
{v
84+
Error: ppxlib: the corrected code doesn't round-trip.
85+
This is probably a bug in the OCaml printer:
86+
<no differences produced by diff>
87+
diff: /tmp/build_2c6e2f_dune/ppxlib6f4ca1: No such file or directory
88+
diff: /tmp/build_2c6e2f_dune/ppxlibaf673d: No such file or directory
89+
Had 2 errors, waiting for filesystem changes...
90+
v}
91+
92+
6. If I save the file again, the code gets reformatted but the error
93+
does not go away.
94+
95+
{v
96+
Error: ppxlib: the corrected code doesn't round-trip.
97+
This is probably a bug in the OCaml printer:
98+
<no differences produced by diff>
99+
Had 1 error, waiting for filesystem changes...
100+
v}
101+
102+
7. If I kill the build, and restart it the error is now different (looks worse):
103+
104+
{v
105+
Error: ppxlib: the corrected code doesn't round-trip.
106+
This is probably a bug in the OCaml printer:
107+
<no differences produced by diff>
108+
Uncaught exception:
109+
110+
(Failure
111+
"Both files, /tmp/build_f345a9_dune/ppxlib7c84c6 and /tmp/build_f345a9_dune/ppxlibe07aed, do not exist")
112+
113+
Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
114+
Called from Dune__exe__Compare.compare_main in file "bin/compare.ml", line 129, characters 7-77
115+
Called from Dune__exe__Compare.main in file "bin/compare.ml", line 174, characters 13-38
116+
Called from Command.For_unix.run.(fun) in file "command/src/command.ml", lines 3388-3399, characters 8-31
117+
Called from Base__Exn.handle_uncaught_aux in file "src/exn.ml", line 126, characters 6-10
118+
v}
119+
*)
63120
type nonrec t = t =
64121
| Root of { rev : Rev.t }
65122
| Commit of
@@ -73,8 +130,29 @@ module Node_kind = struct
73130
}
74131
[@@deriving_inline equal]
75132

76-
[%%ocaml.error
77-
"Ppxlib.Deriving: 'equal' is not a supported type deriving generator"]
133+
let equal =
134+
(fun a__016_ b__017_ ->
135+
if Stdlib.( == ) a__016_ b__017_
136+
then true
137+
else (
138+
match a__016_, b__017_ with
139+
| Root _a__018_, Root _b__019_ -> Rev.equal _a__018_.rev _b__019_.rev
140+
| Root _, _ -> false
141+
| _, Root _ -> false
142+
| Commit _a__020_, Commit _b__021_ ->
143+
Stdlib.( && )
144+
(Rev.equal _a__020_.rev _b__021_.rev)
145+
(Node.equal _a__020_.parent _b__021_.parent)
146+
| Commit _, _ -> false
147+
| _, Commit _ -> false
148+
| Merge _a__022_, Merge _b__023_ ->
149+
Stdlib.( && )
150+
(Rev.equal _a__022_.rev _b__023_.rev)
151+
(Stdlib.( && )
152+
(Node.equal _a__022_.parent1 _b__023_.parent1)
153+
(Node.equal _a__022_.parent2 _b__023_.parent2)))
154+
: t -> t -> bool)
155+
;;
78156

79157
[@@@deriving.end]
80158
end :

0 commit comments

Comments
 (0)