Skip to content

Commit 33a893f

Browse files
committed
fixup ty collision detection
1 parent ce7be3b commit 33a893f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/compiler/compiler.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,9 +1435,10 @@ end = struct
14351435

14361436
let merge k a b =
14371437
match a, b with
1438-
| _, Some (_,loc) -> Some loc
1439-
| Some _, b -> a
1440-
| _ -> anomaly ("ty_names collision: " ^ F.show k) in
1438+
| None, Some (_,loc) -> Some loc
1439+
| Some _, None -> a
1440+
| Some otherloc, Some (_,loc) -> error ~loc ("Duplicate type declaration: " ^ F.show k ^ ". Previous declaration: " ^ Loc.show otherloc)
1441+
| _ -> assert false in
14411442
let ty_names = F.Map.merge merge ty_names kinds in
14421443
let all_ty_names = F.Map.merge merge all_ty_names kinds in
14431444
let types = Type_checker.check_types ~type_abbrevs:all_type_abbrevs ~kinds:all_kinds types in

0 commit comments

Comments
 (0)