Skip to content

Commit

Permalink
[flow] improve Concrete_type_eq.eq for TypeAppTs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
panagosg7 authored and facebook-github-bot committed Dec 3, 2024
1 parent 599550d commit efec76e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/typing/concrete_type_eq.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit efec76e

Please sign in to comment.