Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new release] ppxlib (0.27.0) #21532

Merged
merged 2 commits into from
Jun 15, 2022
Merged

Conversation

pitag-ha
Copy link
Member

Standard library for ppx rewriters

CHANGES:

CHANGES:

- Update expansion context to leave out value name when multiple are
  defined at once. (ocaml-ppx/ppxlib#351, @ceastlund)

- Add support for OCaml 5.0 (ocaml-ppx/ppxlib#348, @pitag-ha)

- Add `Code_path.enclosing_value` (ocaml-ppx/ppxlib#349, @ceastlund)

- Add `Code_path.enclosing_module` (ocaml-ppx/ppxlib#346, @ceastlund)

- Expand code generated by `~enclose_intf` and `~enclose_impl` (ocaml-ppx/ppxlib#345, @ceastlund)

- Add type annotations to code generated by metaquot (ocaml-ppx/ppxlib#344, @ceastlund)

- Fix typo in description field of dune-project (ocaml-ppx/ppxlib#343, @ceastlund)

- Fix Ast_pattern.many (ocaml-ppx/ppxlib#333, @nojb)

- Fix quoter and optimize identifier quoting (ocaml-ppx/ppxlib#327, @sim642)

- Driver, when run with `--check`: Allow `toplevel_printer` attributes (ocaml-ppx/ppxlib#340, @pitag-ha)

- Documentation: Add a section on reporting errors by embedding extension nodes
  in the AST (ocaml-ppx/ppxlib#318, @panglesd)

- Driver: In the case of ppxlib internal errors, embed those errors instead of
  raising to return a meaningful AST (ocaml-ppx/ppxlib#329, @panglesd)

- API: For each function that could raise a located error, add a function that
  return a `result` instead (ocaml-ppx/ppxlib#329, @panglesd)
@kit-ty-kate
Copy link
Member

metaquot seems to have broken a few packages:

#=== ERROR while compiling ppx_yojson_conv.v0.15.0 ============================#
# context              2.1.2 | linux/x86_64 | ocaml-base-compiler.4.14.0 | file:///home/opam/opam-repository
# path                 ~/.opam/4.14/.opam-switch/build/ppx_yojson_conv.v0.15.0
# command              ~/.opam/opam-init/hooks/sandbox.sh build dune build -p ppx_yojson_conv -j 31
# exit-code            1
# env-file             ~/.opam/log/ppx_yojson_conv-1519-c5a2fb.env
# output-file          ~/.opam/log/ppx_yojson_conv-1519-c5a2fb.out
### output ###
# (cd _build/default && /home/opam/.opam/4.14/bin/ocamlc.opt -w -40 -g -bin-annot -I expander/.ppx_yojson_conv_expander.objs/byte -I /home/opam/.opam/4.14/lib/base -I /home/opam/.opam/4.14/lib/base/base_internalhash_types -I /home/opam/.opam/4.14/lib/base/caml -I /home/opam/.opam/4.14/lib/base/shadow_stdlib -I /home/opam/.opam/4.14/lib/ocaml-compiler-libs/common -I /home/opam/.opam/4.14/lib/ocaml-compiler-libs/shadow -I /home/opam/.opam/4.14/lib/ocaml/compiler-libs -I /home/opam/.opam/4.14/lib/ppx_derivers -I /home/opam/.opam/4.14/lib/ppxlib -I /home/opam/.opam/4.14/lib/ppxlib/ast -I /home/opam/.opam/4.14/lib/ppxlib/astlib -I /home/opam/.opam/4.14/lib/ppxlib/print_diff -I /home/opam/.opam/4.14/lib/ppxlib/stdppx -I /home/opam/.opam/4.14/lib/ppxlib/traverse_builtins -I /home/opam/.opam/4.14/lib/sexplib0 -I /home/opam/.opam/4.14/lib/stdlib-shims -intf-suffix .ml -no-alias-deps -open Ppx_yojson_conv_expander__ -o expander/.ppx_yojson_conv_expander.objs/byte/ppx_yojson_conv_expander.cmo -c -impl expander/ppx_yojson_conv_expander.pp.ml)
# File "expander/ppx_yojson_conv_expander.ml", line 534, characters 30-41:
# 534 |       let v_name = [%expr [%e "v_" ^ name]] in
#                                     ^^^^^^^^^^^
# Error: This expression has type Base.String.t = string
#        but an expression was expected of type
#          Ppxlib_ast.Ast.expression = Parsetree.expression
# (cd _build/default && /home/opam/.opam/4.14/bin/ocamlopt.opt -w -40 -g -I expander/.ppx_yojson_conv_expander.objs/byte -I expander/.ppx_yojson_conv_expander.objs/native -I /home/opam/.opam/4.14/lib/base -I /home/opam/.opam/4.14/lib/base/base_internalhash_types -I /home/opam/.opam/4.14/lib/base/caml -I /home/opam/.opam/4.14/lib/base/shadow_stdlib -I /home/opam/.opam/4.14/lib/ocaml-compiler-libs/common -I /home/opam/.opam/4.14/lib/ocaml-compiler-libs/shadow -I /home/opam/.opam/4.14/lib/ocaml/compiler-libs -I /home/opam/.opam/4.14/lib/ppx_derivers -I /home/opam/.opam/4.14/lib/ppxlib -I /home/opam/.opam/4.14/lib/ppxlib/ast -I /home/opam/.opam/4.14/lib/ppxlib/astlib -I /home/opam/.opam/4.14/lib/ppxlib/print_diff -I /home/opam/.opam/4.14/lib/ppxlib/stdppx -I /home/opam/.opam/4.14/lib/ppxlib/traverse_builtins -I /home/opam/.opam/4.14/lib/sexplib0 -I /home/opam/.opam/4.14/lib/stdlib-shims -intf-suffix .ml -no-alias-deps -open Ppx_yojson_conv_expander__ -o expander/.ppx_yojson_conv_expander.objs/native/ppx_yojson_conv_expander.cmx -c -impl expander/ppx_yojson_conv_expander.pp.ml)
# File "expander/ppx_yojson_conv_expander.ml", line 534, characters 30-41:
# 534 |       let v_name = [%expr [%e "v_" ^ name]] in
#                                     ^^^^^^^^^^^
# Error: This expression has type Base.String.t = string
#        but an expression was expected of type
#          Ppxlib_ast.Ast.expression = Parsetree.expression

From my limited ppx knowledge, this new expected type seems weird to me.

@sim642
Copy link
Contributor

sim642 commented Jun 14, 2022

That appears to be the nonsensical use of metaquot as mentioned in ocaml-ppx/ppxlib#344:

Trivial uses of metaquot that put an escape directly inside a quotation essentially compile away to nothing, and can thus return arbitrary types from the escape that make no sense in context.

Both PPXs are using metaquot faultly at one place. From ppxlib.0.27.0 on,
metaquot catches that kind of misuse.
@pitag-ha
Copy link
Member Author

Yes, in metaquot direct anti-quotation + quotation, used to be too polymorphic and both ppx_yojson_conv and ppx_jsonaf_conv seem to have fallen in that. I'm glad metaquot checks the types in that situation now. I've added a ppxlib bound to both of them and will send patches to make them compatible with the latest ppxlib again. It was only those two packages, wasn't it? (jupyter seems to be only transitively affected, if I'm not mistaken)

PD: I'll also backport 5.0 support to an older ppxlib then (tomorrow) to make sure the whole PPX ecosystem supports 5.0.

@kit-ty-kate
Copy link
Member

Thanks

@kit-ty-kate kit-ty-kate merged commit a61fe4d into ocaml:master Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants