From 2bc7dd022798e6071192873f63a579035de79799 Mon Sep 17 00:00:00 2001 From: Crazycolorz5 Date: Sun, 28 Apr 2024 19:41:51 -0400 Subject: [PATCH] Make forall types be considered for recursion. --- src/haz3lcore/statics/Statics.re | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/haz3lcore/statics/Statics.re b/src/haz3lcore/statics/Statics.re index 7e7bb1952c..08518137e2 100644 --- a/src/haz3lcore/statics/Statics.re +++ b/src/haz3lcore/statics/Statics.re @@ -64,21 +64,23 @@ let map_m = (f, xs, m: Map.t) => let add_info = (ids: list(Id.t), info: Info.t, m: Map.t): Map.t => ids |> List.fold_left((m, id) => Id.Map.add(id, info, m), m); +let rec is_arrow_like = (t: Typ.t) => { + switch (t) { + | Unknown(_) => true + | Arrow(_) => true + | Forall(_, t) => is_arrow_like(t) + | _ => false + }; +}; + let is_recursive = (ctx, p, def, syn: Typ.t) => { switch (Term.UPat.get_num_of_vars(p), Term.UExp.get_num_of_functions(def)) { | (Some(num_vars), Some(num_fns)) when num_vars != 0 && num_vars == num_fns => switch (Typ.normalize(ctx, syn)) { - | Unknown(_) - | Arrow(_) => num_vars == 1 | Prod(syns) when List.length(syns) == num_vars => - syns - |> List.for_all( - fun - | Typ.Unknown(_) - | Arrow(_) => true - | _ => false, - ) + syns |> List.for_all(is_arrow_like) + | t when is_arrow_like(t) => num_vars == 1 | _ => false } | _ => false