Skip to content

Don't warn about misplaced attributes in -i mode #1163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions ocaml/parsing/builtin_attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ let attr_order a1 a2 =
| n -> n

let warn_unused () =
let keys = List.of_seq (Attribute_table.to_seq_keys unused_attrs) in
let keys = List.sort attr_order keys in
List.iter (fun sloc ->
Location.prerr_warning sloc.loc (Warnings.Misplaced_attribute sloc.txt))
keys
(* When using -i, attributes will not have been translated, so we can't
warn about missing ones. *)
if !Clflags.print_types then ()
else
let keys = List.of_seq (Attribute_table.to_seq_keys unused_attrs) in
let keys = List.sort attr_order keys in
List.iter (fun sloc ->
Location.prerr_warning sloc.loc (Warnings.Misplaced_attribute sloc.txt))
keys

(* These are the attributes that are tracked in the builtin_attrs table for
misplaced attribute warnings. Explicitly excluded is [deprecated_mutable],
Expand Down