Expected Behavior
Using a :standard atom in an :include file should either:
- Handle the
:standard atom in the same way as if the contents of file had been inlined to replace the :include form, or
- If that is not possible, raise an error indicating that
:standard is not supported inside an :included file (in the same way that trying to use an :include in an :include is an error).
Actual Behavior
Using a :standard atom in an :include file is ignored (or maybe does not resolve to the correct flags, I am not sure).
Reproduction
Consider the following dune file:
(env
(dev
(flags (:standard -does-not-exist))))
(library
(name include_standard)
(modules)
(flags (:include flags.sexp)))
(library
(name standard)
(modules)
(flags (:standard)))
(rule
(action
(write-file flags.sexp "(:standard)")))
dune provides the following outputs:
$ dune build standard.a
File "dune", lines 10-13, characters 0-58:
10 | (library
11 | (name standard)
12 | (modules)
13 | (flags (:standard)))
ocamlopt.opt: unknown option '-does-not-exist'.
Usage: ocamlopt <options> <files>
Try 'ocamlopt --help' for more information.
$ dune build include_standard.a
When using (flags (:standard)) (in the standard.a target), the bogus -does-not-exist flag from the environment is correctly used. But for the include_standard.a target, which goes through an :include, the flags from the environment are ignored.
Specifications
- Version of
dune (output of dune --version): 3.20.2
- Version of
ocaml (output of ocamlc --version): The OCaml toplevel, version 5.3.0
- Operating system (distribution and version): NixOS 25.11
Expected Behavior
Using a
:standardatom in an:includefile should either::standardatom in the same way as if the contents of file had been inlined to replace the:includeform, or:standardis not supported inside an:included file (in the same way that trying to use an:includein an:includeis an error).Actual Behavior
Using a
:standardatom in an:includefile is ignored (or maybe does not resolve to the correct flags, I am not sure).Reproduction
Consider the following
dunefile:duneprovides the following outputs:When using
(flags (:standard))(in thestandard.atarget), the bogus-does-not-existflag from the environment is correctly used. But for theinclude_standard.atarget, which goes through an:include, the flags from the environment are ignored.Specifications
dune(output ofdune --version): 3.20.2ocaml(output ofocamlc --version): The OCaml toplevel, version 5.3.0