Skip to content

Commit d1be563

Browse files
authored
flambda-backend: Don't warn about misplaced attributes in -i mode (#1163)
1 parent feefcaa commit d1be563

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

parsing/builtin_attributes.ml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ let attr_order a1 a2 =
3737
| n -> n
3838

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

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

0 commit comments

Comments
 (0)