Skip to content

Commit

Permalink
check for hash collisions in induced pre signature
Browse files Browse the repository at this point in the history
  • Loading branch information
crusso committed Jan 8, 2025
1 parent 568d090 commit 20be12c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/mo_frontend/typing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,7 @@ and check_migration env exp_opt =


and check_stab env sort exp_opt scope dec_fields =
let (_dom_tfs, rng_tfs) = check_migration env exp_opt in
let (dom_tfs, rng_tfs) = check_migration env exp_opt in
let check_stable id at =
match T.Env.find_opt id scope.Scope.val_env with
| None -> assert false
Expand Down Expand Up @@ -2664,6 +2664,19 @@ and check_stab env sort exp_opt scope dec_fields =
in
let ids = List.concat idss in
check_ids env "actor type" "stable variable" ids;
begin
if not (dom_tfs = []) then
(* check for collisions in induced pre signature *)
let dom_ids = List.map (fun tf -> T.{it = tf.lab; at = tf.src.region; note = ()}) dom_tfs in
let pre_ids =
dom_ids @
(List.filter_map
(fun id ->
if List.exists (fun dom_id -> dom_id.it = id.it) dom_ids then None else Some id)
ids)
in
check_ids env "pre actor type" "stable variable" pre_ids
end;
let ids = List.map (fun id -> id.it) ids in
List.iter (fun T.{lab;typ;src} ->
match typ with
Expand Down

0 comments on commit 20be12c

Please sign in to comment.