ocaml / opam-file-format

Parser and printer for the opam file syntax
Other
15 stars 23 forks source link

OpamParserTypes is now a module #37

Closed dra27 closed 3 years ago

dra27 commented 3 years ago

2.1.1 added OpamParserTypes.FullPos. Unfortunately, this means that OpamParserTypes is no longer an mli-only module. The Makefile build system attests this:

ocamlopt -c  opamParser.ml
File "_none_", line 1:
Warning 58: no cmx file was found in path for module OpamParserTypes, and its interface was not compiled with -opaque

and indeed we get link errors like this:

File "test_parser.ml", line 1:
Error: No implementations provided for the following modules:
         OpamParserTypes referenced from opam-file-format.cmxa(OpamParser)

Dune avoids this problem because OpamParser is compiled with -no-alias-deps which removes the link dependency on an implementation for OpamParserTypes. #36 essentially replicates this in the Makefile, but this still doesn't fix the underlying problem:

module F = OpamParserTypes.FullPos

which with both #36 and with Dune leads to:

dra27@summer:~/opam-file-format/src$ ocamlopt opam-file-format.cmxa -o broken broken.ml
File "broken.ml", line 1:
Error: No implementations provided for the following modules:
         OpamParserTypes referenced from broken.cmx

unless broken.ml itself is compiled with -no-alias-deps. Note that these modules have no business being compiled with -no-alias-deps (they don't really in Dune either) and compiling everything with -opaque kills cross-module inlining.

So this PR converts OpamParserTypes.mli to OpamParserTypes.ml which should fix the problem in both build systems.

dra27 commented 3 years ago

The ocaml-ci failure is just https://github.com/ocurrent/opam-dune-lint/issues/12