ocaml-ppx / ppx_import

Less redundancy in type declarations and signatures
MIT License
89 stars 28 forks source link

Incompatibility with 4.08 syntax #50

Closed christophe-riolo closed 3 years ago

christophe-riolo commented 4 years ago

I had a bug in my program that I could reproduce with a minimal example. I installed a fresh 4.08.1 opam switch, and installed only ppx_import, then tried to compile the following code:

module Foo(M: sig type t end) = struct
  type t = [%import: M.t]
end

open Foo(Int)

Dune file being:

(executable
 (name foo)
 (preprocess (staged_pps ppx_import))
)

The error I get when I try to compile is:

    ocamldep .foo.eobjs/foo.ml.d (exit 2)
(cd _build/default && /tmp/_opam/bin/ocamldep.opt -modules -ppx '.ppx/730a1ffc71e71794f0005821abd2de02/ppx.exe --as-ppx' -impl foo.ml) > _build/default/.foo.eobjs/foo.ml.d
Fatal error: exception File "foo.ml", line 5, characters 0-13: complex open are not supported before OCaml 4.08
File "foo.ml", line 1:
Error: Error while running external preprocessor
Command line: .ppx/730a1ffc71e71794f0005821abd2de02/ppx.exe --as-ppx '/tmp/camlppxc8c780' '/tmp/camlppxef952c'

In my project I had the same error when trying to use let* also. Removing the preprocessing stanza and the %import removes the error.

sim642 commented 3 years ago

I'm having a similar issue but with local module substitutions under 4.11.1, which makes no sense. Apparently ppx_import is still using Ast_407.