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

Broken with ppx using ppx_driver "Error: Attribute `with' was not used" #17

Closed
ejgallego opened this issue Aug 29, 2017 · 12 comments
Closed

Comments

@ejgallego
Copy link
Collaborator

When using ppx_import with some other ppx rewriters such as ppx_sexp_conv we get:

ocamlfind ocamldep -package threads -package ppx_import -package ppx_sexp_conv -package str -package coq.intf -package sexplib -package coq.stm -package unix -package num -modules serlib/ser_declarations.ml > serlib/ser_declarations.ml.depends
File "serlib/ser_declarations.ml", line 59, characters 4-8:
Error: Attribute `with' was not used

Thanks!

@whitequark
Copy link
Contributor

OK, ppx_deriving and ppx_sexp_conv coexistence is currently completely unusable. This is bad.
cc @diml

@ejgallego
Copy link
Collaborator Author

ejgallego commented Aug 29, 2017

Edit: Adding -ppxopt "ppx_sexp_conv,-no-check" does not seem to fix the issue.

@ejgallego
Copy link
Collaborator Author

Ups, I was wrong, I was not able to fix the problem with -no-check.

@ejgallego
Copy link
Collaborator Author

I traced this back to ppx_deriving 4.2. Downgrading to 4.1 solves the problem.

@ejgallego
Copy link
Collaborator Author

That has been working fine for some time; thanks to all who have helped!

@ejgallego
Copy link
Collaborator Author

Well, the v0.10.0 versions of the JS stuff has broken ppx_import again:

File "sertop/sertop_sexp.ml", line 134, characters 4-8:
Error: Attribute `with' was not used

the situation continues to be a bit frustrating I'm afraid :(

@ejgallego ejgallego reopened this Dec 20, 2017
@gasche
Copy link
Contributor

gasche commented Dec 20, 2017

If I understand things correctly, we (people willing to fix bugs in ppx_import) have no control/agency over what the drivers that you use decide to do, and to fix the problem you observe. So it's good to open the PR here to track progress, but you should really creating an issue with the people who released "the v0.10.0 versions of the JS stuff", because the fix may be on their side.

@ejgallego
Copy link
Collaborator Author

ejgallego commented Dec 20, 2017

Thanks for you help @gasche , I am afraid that even after reading ocaml-ppx/ppx_deriving#153 , I don't understand what is going on, and how to even start looking at the problem.

All that I have is a simple _tags file with:

<...>: package(ppx_import), package(ppx_sexp_conv)

and a declaration such as:

type regular_inductive_arity =
  [%import: Declarations.regular_inductive_arity
  [@with Term.sorts := Sorts.t;]]
  [@@deriving sexp]

that was working fine, now I just did opam upgrade, and everything breaks again...

How am I supposed to provide a working package? I am just naive trying to combine two ppx?

What is the proper package to report the bug? In my system I see:

ppx_ast                       v0.10.0  OCaml AST used by Jane Street ppx rewrite
ppx_base                      v0.10.0  Base set of ppx rewriters
ppx_compare                   v0.10.0  Generation of comparison functions from t
ppx_core                      v0.10.0  Standard library for ppx rewriters
ppx_derivers                      1.0  Shared [@@deriving] plugin registry
ppx_deriving                    4.2.1  Type-driven code generation for OCaml >=4
ppx_driver                    v0.10.0  Feature-full driver for OCaml AST transfo
ppx_enumerate                 v0.10.0  Generate a list containing all values of 
ppx_hash                      v0.10.0  A ppx rewriter that generates hash functi
ppx_import                        1.4  A syntax extension for importing declarat
ppx_js_style                  v0.10.0  Code style checker for Jane Street Packag
ppx_metaquot                  v0.10.0  Write OCaml AST fragment using OCaml synt
ppx_optcomp                   v0.10.0  Optional compilation for OCaml
ppx_sexp_conv                 v0.10.0  Generation of S-expression conversion fun
ppx_tools                  5.1+4.06.0  Tools for authors of ppx rewriters and ot
ppx_tools_versioned             5.0.1  A variant of ppx_tools based on ocaml-mig
ppx_traverse_builtins         v0.10.0  Builtins for Ppx_traverse
ppx_type_conv                 v0.10.0  Support Library for type-driven code gene

I am having trouble to track which package is the one to blame here.
Thanks for you time and sorry for bugging you again.

@ghost
Copy link

ghost commented Dec 20, 2017

It seems that a change in ppx_driver.v0.9 wasn't properly integrated in the development version. Hopefully this should be fixed by ocaml/opam-repository#11078

@gasche
Copy link
Contributor

gasche commented Dec 20, 2017

@diml thanks! I was about to ping you.

@ejgallego
Copy link
Collaborator Author

Thanks @diml !

@ejgallego
Copy link
Collaborator Author

v0.10.1 seems to solve the problem, uff, what a relief! XD. Thanks to both again!

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

No branches or pull requests

3 participants