Strange Pprintast output with ppx_deriving #7232
Original bug ID: 7232
Printing an AST produced by ppx_deriving.show with Pprintast results in different spacing than entering the same source code directly and printing that. I haven't fully diagnosed the issue due to a lack of time, but I suppose ppx_deriving.show is programmatically generating some AST construct that hasn't received as much attention as constructs generated by the OCaml parser for the literal code.
This complicates testing using textual diffs.
Steps to reproduce
opam install ocamlfind ppx_deriving ppx_tools.
type a = Foo [@@deriving show]
.PHONY : test
This results in the output:
type a =
and show_a : a -> Ppx_deriving_runtime.string=
However, parsing and re-printing the let rec ... and ... definitions directly results in a space before the "=" character on the line with "and".
Comment author: antron
IIRC, the output was much messier in 4.02.3. It looks like many parts of that mess have been cleaned up, so perhaps that's what is familiar.