Skip to content

Commit

Permalink
Steps to trigger some build issues related to deriving_inline
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbin committed Oct 21, 2024
1 parent 593e9de commit a02920b
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/vcs/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
(preprocess
(pps
-unused-code-warnings=force
ppx_compare
ppx_enumerate
ppx_sexp_conv
ppx_sexp_value)))
82 changes: 80 additions & 2 deletions lib/vcs/src/graph.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,63 @@ module Node_kind = struct

include (
struct
(* CR mbarbin: Here is a sequence that produces some issue for me:
1, Starting from a build in watch mode: `dune build @all @lint -w`
2. After everything stabilizes, I get the "Success, waiting for
filesystem changes..." output from dune.
Then I try the following:
3. Replace the `@@deriving` by a `@@deriving_inline`, and add an additional
line after it: `[@@@deriving.end]`.
4. Save the file.
This triggers a rebuild, and a promotion error that shows the code to be inserted.
5. I run: `dune promote`.
This creates the following error:
{v
Error: ppxlib: the corrected code doesn't round-trip.
This is probably a bug in the OCaml printer:
<no differences produced by diff>
diff: /tmp/build_2c6e2f_dune/ppxlib6f4ca1: No such file or directory
diff: /tmp/build_2c6e2f_dune/ppxlibaf673d: No such file or directory
Had 2 errors, waiting for filesystem changes...
v}
6. If I save the file again, the code gets reformatted but the error
does not go away.
{v
Error: ppxlib: the corrected code doesn't round-trip.
This is probably a bug in the OCaml printer:
<no differences produced by diff>
Had 1 error, waiting for filesystem changes...
v}
7. If I kill the build, and restart it the error is now different (looks worse):
{v
Error: ppxlib: the corrected code doesn't round-trip.
This is probably a bug in the OCaml printer:
<no differences produced by diff>
Uncaught exception:
(Failure
"Both files, /tmp/build_f345a9_dune/ppxlib7c84c6 and /tmp/build_f345a9_dune/ppxlibe07aed, do not exist")
Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
Called from Dune__exe__Compare.compare_main in file "bin/compare.ml", line 129, characters 7-77
Called from Dune__exe__Compare.main in file "bin/compare.ml", line 174, characters 13-38
Called from Command.For_unix.run.(fun) in file "command/src/command.ml", lines 3388-3399, characters 8-31
Called from Base__Exn.handle_uncaught_aux in file "src/exn.ml", line 126, characters 6-10
v}
*)
type nonrec t = t =
| Root of { rev : Rev.t }
| Commit of
Expand All @@ -73,8 +130,29 @@ module Node_kind = struct
}
[@@deriving_inline equal]

[%%ocaml.error
"Ppxlib.Deriving: 'equal' is not a supported type deriving generator"]
let equal =
(fun a__016_ b__017_ ->
if Stdlib.( == ) a__016_ b__017_
then true
else (
match a__016_, b__017_ with
| Root _a__018_, Root _b__019_ -> Rev.equal _a__018_.rev _b__019_.rev
| Root _, _ -> false
| _, Root _ -> false
| Commit _a__020_, Commit _b__021_ ->
Stdlib.( && )
(Rev.equal _a__020_.rev _b__021_.rev)
(Node.equal _a__020_.parent _b__021_.parent)
| Commit _, _ -> false
| _, Commit _ -> false
| Merge _a__022_, Merge _b__023_ ->
Stdlib.( && )
(Rev.equal _a__022_.rev _b__023_.rev)
(Stdlib.( && )
(Node.equal _a__022_.parent1 _b__023_.parent1)
(Node.equal _a__022_.parent2 _b__023_.parent2)))
: t -> t -> bool)
;;

[@@@deriving.end]
end :
Expand Down

0 comments on commit a02920b

Please sign in to comment.