From efec76e3da0c7d2229008e8b5ddaa253dc3de6eb Mon Sep 17 00:00:00 2001 From: Panos Vekris Date: Mon, 2 Dec 2024 17:27:49 -0800 Subject: [PATCH] [flow] improve Concrete_type_eq.eq for TypeAppTs Summary: Makes the Concrete_type_eq check a bit more robust in the presence of TypeAppTs. Changelog: [internal] Reviewed By: gkz Differential Revision: D66558958 fbshipit-source-id: 84b86ca6ea38a328087a808df2965701f9a27b1a --- src/typing/concrete_type_eq.ml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/typing/concrete_type_eq.ml b/src/typing/concrete_type_eq.ml index 16265aed4c2..82477920c52 100644 --- a/src/typing/concrete_type_eq.ml +++ b/src/typing/concrete_type_eq.ml @@ -70,4 +70,15 @@ let rec eq cx t1 t2 = (match Type.Eval.Map.find_opt id (Context.evaluated cx) with | Some t -> eq cx t1 t | None -> compare t1 (swap_reason t2 t1) = 0) + | ( TypeAppT + { reason = _; use_op = _; type_ = t1; targs = targs1; from_value = fv1; use_desc = _ }, + TypeAppT + { reason = _; use_op = _; type_ = t2; targs = targs2; from_value = fv2; use_desc = _ } + ) -> + eq cx t1 t2 && fv1 = fv2 && eq_targs cx targs1 targs2 | _ -> compare t1 (swap_reason t2 t1) = 0 + +and eq_targs cx targs1 targs2 = + match Base.List.for_all2 targs1 targs2 ~f:(eq cx) with + | Base.List.Or_unequal_lengths.Ok v -> v + | Base.List.Or_unequal_lengths.Unequal_lengths -> false