Skip to content

Commit

Permalink
fix(ppx): mark @@@mel.config used in interface files too
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed Oct 20, 2023
1 parent 316f64f commit a09fb39
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Unreleased
- Make `'a Js.t` abstract (again), fixing a regression when bringing back
OCaml-style objects BuckleScript
([#786](https://github.com/melange-re/melange/pull/786))
- Don't issue "unused attribute" warning for well-formed `@@@mel.config` in
interface files ([#800](https://github.com/melange-re/melange/pull/800))

2.0.0 2023-09-13
---------------
Expand Down
8 changes: 8 additions & 0 deletions ppx/melange_ppx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,14 @@ module Mapper = struct
:: pval_attributes;
};
})
| Psig_attribute
({
(* TODO: remove support for bs.* *)
attr_name = { txt = "bs.config" | "mel.config" | "config"; _ };
_;
} as attr) ->
Bs_ast_invariant.mark_used_bs_attribute attr;
sigi
| _ -> super#signature_item sigi
end
end
Expand Down
7 changes: 0 additions & 7 deletions test/blackbox-tests/unused-attributes.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,3 @@
> [@@@mel.config { flags = [|"-unboxed-types"|] }]
> EOF
$ melc -ppx melppx x.mli
File "x.mli", line 1, characters 6-16:
1 | [@@@mel.config { flags = [|"-unboxed-types"|] }]
^^^^^^^^^^
Alert unused: Unused attribute [@mel.config]
This means such annotation is not annotated properly.
For example, some annotations are only meaningful in externals

0 comments on commit a09fb39

Please sign in to comment.