Skip to content

:standard in an :included file is ignored #13225

@bclement-ocp

Description

@bclement-ocp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions