Skip to content

floating attributes in module aliases with -no-alias-deps are ignored #11867

@nojb

Description

@nojb

This note is meant to bring a shortcoming of -no-alias-deps to the attention of the rest of the developers, even if the beheaviour makes sense (as far as I understand module aliases). This flag, and module aliases, are used by Dune to implement wrapping of libraries and executables (see ocaml/dune#6820 for a related issue over at the Dune issue tracker).

Consider a file foo.ml with contents:

[@@@alert deprecated "Do not use this module."]
let x = 12

and a file main.ml with contents:

module F = Foo
let _ = Foo.x
let _ = F.x

Compile with:

$ ocamlc -c foo.ml
$ ocamlc -no-alias-deps -c main.ml
File "main.ml", line 2, characters 8-13:
2 | let _ = Foo.x
            ^^^^^
Alert deprecated: module Foo
Do not use this module.

and note that no alert is triggered for F.x which goes through the module alias.

Metadata

Metadata

Assignees

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