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

For the debug tallying directive, make sur that when one writes:

debug tallying ([] [ ('a, Int)  ('a, Bool) ])
the two instances of 'a refer to the same variable internally.
parent 421fcbfc
Pipeline #189 passed with stages
in 4 minutes and 26 seconds
......@@ -230,15 +230,36 @@ let debug ppf tenv _cenv = function
(Var.Set.add v acc_d, (u, v) :: acc_v))
(Var.Set.empty, []) delta
in
let tprobs =
List.map
(fun (p1, p2) ->
( Types.descr @@ Typer.var_typ vlist tenv p1,
Types.descr @@ Typer.var_typ vlist tenv p2 ))
tlist
let tprobs, _ =
List.fold_left
(fun (acc_t, acc_v) (p1, p2) ->
let t1 = Types.descr @@ Typer.var_typ acc_v tenv p1 in
let nv1 = Types.Subst.vars t1 in
let acc_v =
List.fold_left
(fun acc_v v ->
let u = U.mk (Var.name v) in
if List.mem_assoc u acc_v then acc_v else (u, v) :: acc_v)
acc_v nv1
in
let t2 = Types.descr @@ Typer.var_typ acc_v tenv p2 in
let nv2 = Types.Subst.vars t2 in
let acc_v =
List.fold_left
(fun acc_v v ->
let u = U.mk (Var.name v) in
if List.mem_assoc u acc_v then acc_v else (u, v) :: acc_v)
acc_v nv2
in
((t1, t2) :: acc_t, acc_v))
([], vlist) tlist
in
let subst = Types.Tallying.tallying delta tprobs in
Format.fprintf ppf "Result:%a@." Types.Subst.print_list subst
Format.fprintf ppf "Result:%a@." Types.Subst.print_list subst;
Format.fprintf ppf "Cleaned result:%a@." Types.Subst.print_list
(List.map
(fun s -> Var.Map.map (fun t -> Types.Subst.clean_type delta t) s)
subst)
let flush_ppf ppf = Format.fprintf ppf "@."
......
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