ocaml-ppx / ppx_tools

Tools for authors of ppx rewriters
MIT License
134 stars 39 forks source link

ppx_metaquot cannot generate expressions with 4.08.0 #77

Open mrmr1993 opened 5 years ago

mrmr1993 commented 5 years ago

This is the dual issue of #75: pexp_loc_stack, ptyp_loc_stack, ppat_loc_stack need to be present code generated by the ppx, but aren't. For example:

let x = [%expr "test"]

fails at compile-time with the error Some record fields are undefined: pexp_loc_stack.

kit-ty-kate commented 5 years ago

cc @hhugo

kit-ty-kate commented 5 years ago

Which version of ppx_tools are you using?

mrmr1993 commented 5 years ago

Which version of ppx_tools are you using?

5.3+4.08.0

hhugo commented 5 years ago

I cannot reproduce this issue

$ echo 'let x = [%expr "test"]' > a.ml
$ ocamlc -c -ppx ~/opam/4.08.0/lib/ppx_tools/ppx_metaquot a.ml -I +compiler-libs -dsource 
let x =
  {
    Parsetree.pexp_desc =
      (Parsetree.Pexp_constant (Parsetree.Pconst_string ("test", None)));
    Parsetree.pexp_loc = (Stdlib.(!) Ast_helper.default_loc);
    Parsetree.pexp_loc_stack = [];
    Parsetree.pexp_attributes = []
  }
tizoc commented 4 years ago

To add to this, I was experiencing the same problem as noted in https://github.com/tizoc/ppx_pgsql/issues/8

Changing the versioned Ast from Ast_406 to Ast_408 fixed the issue.