Skip to content

Commit 92e58be

Browse files
committed
disable the hash collision test for bs
1 parent 7573959 commit 92e58be

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

typing/typetexp.ml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,19 +512,25 @@ and transl_type_aux env policy styp =
512512
row_bound=(); row_closed=true;
513513
row_fixed=false; row_name=None}) in
514514
let hfields = Hashtbl.create 17 in
515+
let collection_detect = Hashtbl.create 17 in
515516
let add_typed_field loc l f =
516-
let h = Btype.hash_variant l in
517+
if not !Config.bs_only then begin
518+
let h = Btype.hash_variant l in
519+
if Hashtbl.mem collection_detect h then
520+
let l' = Hashtbl.find collection_detect h in
521+
(* Check for tag conflicts *)
522+
if l <> l' then raise(Error(styp.ptyp_loc, env, Variant_tags(l, l')));
523+
else Hashtbl.add collection_detect h l
524+
end ;
517525
try
518-
let (l',f') = Hashtbl.find hfields h in
519-
(* Check for tag conflicts *)
520-
if l <> l' then raise(Error(styp.ptyp_loc, env, Variant_tags(l, l')));
526+
let (_,f') = Hashtbl.find hfields l in
521527
let ty = mkfield l f and ty' = mkfield l f' in
522528
if equal env false [ty] [ty'] then () else
523529
try unify env ty ty'
524530
with Unify _trace ->
525531
raise(Error(loc, env, Constructor_mismatch (ty,ty')))
526532
with Not_found ->
527-
Hashtbl.add hfields h (l,f)
533+
Hashtbl.add hfields l (l,f)
528534
in
529535
let add_field = function
530536
Rtag (l, attrs, c, stl) ->

0 commit comments

Comments
 (0)