Skip to content

Commit efec76e

Browse files
panagosg7facebook-github-bot
authored andcommitted
[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
1 parent 599550d commit efec76e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/typing/concrete_type_eq.ml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,15 @@ let rec eq cx t1 t2 =
7070
(match Type.Eval.Map.find_opt id (Context.evaluated cx) with
7171
| Some t -> eq cx t1 t
7272
| None -> compare t1 (swap_reason t2 t1) = 0)
73+
| ( TypeAppT
74+
{ reason = _; use_op = _; type_ = t1; targs = targs1; from_value = fv1; use_desc = _ },
75+
TypeAppT
76+
{ reason = _; use_op = _; type_ = t2; targs = targs2; from_value = fv2; use_desc = _ }
77+
) ->
78+
eq cx t1 t2 && fv1 = fv2 && eq_targs cx targs1 targs2
7379
| _ -> compare t1 (swap_reason t2 t1) = 0
80+
81+
and eq_targs cx targs1 targs2 =
82+
match Base.List.for_all2 targs1 targs2 ~f:(eq cx) with
83+
| Base.List.Or_unequal_lengths.Ok v -> v
84+
| Base.List.Or_unequal_lengths.Unequal_lengths -> false

0 commit comments

Comments
 (0)