Open
Description
Given the following contents in test.ml
:
type t = string
[@@deriving show]
let () =
print_endline (show "foo")
And a ppx binary to do the transforms:
$ ocamlfind opt -predicates ppx_driver -package ppx_deriving.show -package ppxlib.runner -linkpkg -linkall -o ppx_driver
We get the following output from ./ppx_driver test.ml
type t = string[@@deriving show]
let rec pp
: Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unit =
((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in
fun fmt -> Ppx_deriving_runtime.Format.fprintf fmt "%S")
[@ocaml.warning "-A"])
and show : t -> Ppx_deriving_runtime.string =
fun x -> Ppx_deriving_runtime.Format.asprintf "%a" pp x[@@ocaml.warning
"-32"]
include struct let _ = fun (_ : t) -> () end[@@ocaml.doc "@inline"][@@merlin.hide
]
let () = print_endline (show "foo")
If we then try to compile that code:
$ ocamlopt test.pp.ml
File "test.pp.ml", line 3, characters 4-41:
3 | : Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unit =
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound module Ppx_deriving_runtime
[[email protected] ~/local/ocaml5]$ ocamlfind ocamlopt -package ppx_deriving.runtime test.pp.ml
File "test.pp.ml", line 4, characters 39-52:
4 | ((let open! ((Ppx_deriving_runtime)[@ocaml.warning "-A"]) in
^^^^^^^^^^^^^
Warning 53 [misplaced-attribute]: the "ocaml.warning" attribute cannot appear in this context
This is from a clean switch with ocaml.5.2~alpha1 and ppx_deriving
$ opam list
# Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-domains base
base-nnp base Naked pointers prohibited in the OCaml heap
base-threads base
base-unix base
cppo 1.6.9 Code preprocessor like cpp for OCaml
dune 3.14.2 Fast, portable, and opinionated build system
ocaml 5.2.0 The OCaml compiler (virtual package)
ocaml-compiler-libs v0.17.0 OCaml compiler libraries repackaged
ocaml-config 3 OCaml Switch Configuration
ocaml-option-flambda 1 Set OCaml to be compiled with flambda activated
ocaml-option-fp 1 Set OCaml to be compiled with frame-pointers enabled
ocaml-option-no-compression 1 Set OCaml to be compiled with --without-zstd
ocaml-variants 5.2.0~alpha1+options First alpha release of OCaml 5.2.0
ocamlfind 1.9.6 A library manager for OCaml
ppx_derivers 1.2.1 Shared [@@deriving] plugin registry
ppx_deriving 5.2.1 Type-driven code generation for OCaml
ppxlib 0.32.1~5.2preview Standard infrastructure for ppx rewriters
result 1.5 Compatibility Result module
sexplib0 v0.16.0 Library containing the definition of S-expressions and some base converters
stdlib-shims 0.3.0 Backport some of the new stdlib features to older compiler
Metadata
Metadata
Assignees
Labels
No labels