You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7232 Reporter: antron Assigned to:@damiendoligez Status: closed (set by @damiendoligez on 2016-04-19T12:42:37Z) Resolution: fixed Priority: normal Severity: minor Target version: 4.03.0+dev / +beta1 Fixed in version: 4.03.0+dev / +beta1 Category: ~DO NOT USE (was: OCaml general) Monitored by:@hcarty
Bug description
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.
.PHONY : test
test :
ocamlfind ppx_tools/rewriter -ppx '$(PPX)' foo.ml
This results in the output:
type a =
| Foo [@@deriving show]
let rec (pp_a : Format.formatter -> a -> Ppx_deriving_runtime.unit) =
((let open! Ppx_deriving_runtime in
fun fmt -> function | Foo -> Format.pp_print_string fmt "Foo.Foo")
[@ocaml.warning "-A"])
and show_a : a -> Ppx_deriving_runtime.string=
fun x -> Format.asprintf "%a" pp_a x
However, parsing and re-printing the let rec ... and ... definitions directly results in a space before the "=" character on the line with "and".
The text was updated successfully, but these errors were encountered:
Original bug ID: 7232
Reporter: antron
Assigned to: @damiendoligez
Status: closed (set by @damiendoligez on 2016-04-19T12:42:37Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @hcarty
Bug description
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.
foo.ml:
type a = Foo [@@deriving show]
Makefile:
PPX_DERIVING =$(PPX_DERIVING)/ppx_deriving $ (PPX_DERIVING)/ppx_deriving_show.cma
ocamlfind query ppx_deriving
PPX =
.PHONY : test
test :
ocamlfind ppx_tools/rewriter -ppx '$(PPX)' foo.ml
This results in the output:
type a =
| Foo [@@deriving show]
let rec (pp_a : Format.formatter -> a -> Ppx_deriving_runtime.unit) =
((let open! Ppx_deriving_runtime in
fun fmt -> function | Foo -> Format.pp_print_string fmt "Foo.Foo")
[@ocaml.warning "-A"])
and show_a : a -> Ppx_deriving_runtime.string=
fun x -> Format.asprintf "%a" pp_a x
However, parsing and re-printing the let rec ... and ... definitions directly results in a space before the "=" character on the line with "and".
The text was updated successfully, but these errors were encountered: