We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9eb6a83 commit 2034d8eCopy full SHA for 2034d8e
jscomp/ml/typedecl.ml
@@ -470,6 +470,13 @@ let transl_declaration env sdecl id =
470
in
471
process_lbls ([], []) lbls lbls'
472
| _ -> lbls, lbls' in
473
+ let rec check_duplicates (lbls : Typedtree.label_declaration list) seen = match lbls with
474
+ | [] -> ()
475
+ | lbl::rest ->
476
+ let name = lbl.ld_id.name in
477
+ if StringSet.mem name seen then raise(Error(lbl.ld_loc, Duplicate_label name));
478
+ check_duplicates rest (StringSet.add name seen) in
479
+ check_duplicates lbls StringSet.empty;
480
Ttype_record lbls, Type_record(lbls', rep)
481
| Ptype_open -> Ttype_open, Type_open
482
0 commit comments