diff --git a/engine/lib/phases/phase_functionalize_loops.ml b/engine/lib/phases/phase_functionalize_loops.ml index 35591e89f..07b010714 100644 --- a/engine/lib/phases/phase_functionalize_loops.ml +++ b/engine/lib/phases/phase_functionalize_loops.ml @@ -76,7 +76,7 @@ struct | StepBy of { n : B.expr; it : iterator } [@@deriving show] - let rec as_iterator (e : B.expr) : iterator option = + let rec as_iterator' (e : B.expr) : iterator option = match e.e with | Construct { @@ -93,6 +93,12 @@ struct Some (Range { start; end_ }) | _ -> meth_as_iterator e + and as_iterator (e : B.expr) : iterator option = + let result = as_iterator' e in + (* UB.Debug.expr ~label:"as_iterator" e; *) + (* " = " ^ [%show: iterator option] result |> Stdio.prerr_endline; *) + result + and meth_as_iterator (e : B.expr) : iterator option = let* f, args = match e.e with @@ -112,7 +118,7 @@ struct then let* iterable = one_arg () in match iterable.typ with - | TSlice _ -> Some (Slice iterable) + | TSlice _ | TArray _ -> Some (Slice iterable) | _ -> as_iterator iterable else if f_eq Core__iter__traits__iterator__Iterator__enumerate then let* iterable = one_arg () in