dune icon indicating copy to clipboard operation
dune copied to clipboard

-opaque option breaks equivalence between release and dev compilation in presence of [@inline always]

Open craff opened this issue 4 years ago • 10 comments

Expected Behavior

dune build and dune build --release should both work or both fail

Actual Behavior

If the code contains [@inline always], dune build may fail with error File "test.ml", line 12, characters 18-52: 12 | module FloatMat = Mat.Make [@inlined always] (Float) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error (warning 55): Cannot inline: Unknown function

because of the -opaque option, while dune build --release succeed.

Reproduction

Easy!

  • Proposed solution remove warn_error for warning 55 and maybe others when compiling in dev mode.
  • Other possible solution: do not use -opaque is [@inline always] and similar appears in the code (if the user thinks inlining is really important, one should not use -opaque.
  • PR with a reproducing test:
  1. Create a first file with a functor or funciton
  2. Ask to inline this in another file with [@inline always]

Specifications

  • Version of dune (output of dune --version): 2.7.1
  • Version of ocaml (output of ocamlc --version): 3.11.1 and 3.11.1+flambda
  • Operating system (distribution and version): debian testing

Additional information

  • Link to gist with verbose output (run dune with the --verbose flag):

craff avatar Jan 15 '21 03:01 craff