Skip to content

Protect sites names against reserved keywords #4219

@Lelio-Brun

Description

@Lelio-Brun

Expected Behavior

Compilation success.

Actual Behavior

Compilation error.

Reproduction

  1. define a site whose name is a reserved Ocaml keyword, eg.,
    dune-project:
    (package
     (name my-package)
     (sites (lib include))
    
    dune:
    (generate_sites_module
     (module sites)
     (sites my-package))
    ...
    
  2. dune build generates and tries to build the following Sites.ml:
    module Sites = struct
        let include = Dune_site.Private_.Helpers.site
          ~package:"my-package"
          ~section:Dune_section.Lib
          ~suffix:"include"
          ~encoded:(Sys.opaque_identity "%%DUNE_PLACEHOLDER:...%%")
    end
  3. Compilation obviously fails with a syntax error.

Specifications

  • Version of dune (output of dune --version): 2.8.2
  • Version of ocaml (output of ocamlc --version): 4.11.1
  • Operating system (distribution and version): Ubuntu 20.04.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions