Commit 01e9ada9 authored by Kim Nguyễn's avatar Kim Nguyễn
Browse files

Simplify (and fix) the code adding variables of a function interface to delta...

Simplify (and fix) the code adding variables of a function interface to delta during the typing of its body.
parent d7b41a1a
...@@ -977,21 +977,13 @@ and type_check' loc env ed constr precise = match ed with ...@@ -977,21 +977,13 @@ and type_check' loc env ed constr precise = match ed with
in in
(* update \delta with all variables in t1 -> t2 *) (* update \delta with all variables in t1 -> t2 *)
let deltaintf = let delta_intf =
let union (t1,t2) = List.fold_left (fun acc (t1, t2) ->
Var.Set.union Var.Set.(union acc (union (Types.all_vars t1) (Types.all_vars t2)))
(Types.all_vars(t1)) ) env.delta a.fun_iface
(Types.all_vars(t2))
in
match a.fun_iface with
|[] -> Var.Set.empty
|head::tail ->
List.fold_left (fun acc intf ->
Var.Set.inter (union intf) acc
) (union head) tail
in in
let env = {env with delta = Var.Set.union env.delta deltaintf } in let env = {env with delta = delta_intf } in
(* I check the body with all possible t1 -> t2 types *) (* I check the body with all possible t1 -> t2 types *)
let sll = let sll =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment