Skip to content

Commit cc9987e

Browse files
committed
Add comment explaining why TypeUtils.resolveTypeForPipeCompletion enforces a maximum iteration count and add TODO about fixing the root of the issue
1 parent 971b5ea commit cc9987e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

analysis/src/TypeUtils.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,10 @@ let rec resolveTypeForPipeCompletion ~env ~package ~lhsLoc ~full ?(depth = 0)
540540
in
541541
match typFromLoc with
542542
| Some typFromLoc ->
543+
(* Prevent infinite loops when `typFromLoc` is a type variable by bailing out after
544+
10 iterations.
545+
TODO: fix the root of the issue (probably in `findReturnTypeOfFunctionAtLoc`)
546+
instead of enforcing a maximum number of iterations. *)
543547
if depth > 10 then (env, typFromLoc)
544548
else
545549
typFromLoc

0 commit comments

Comments
 (0)