Skip to content

Commit

Permalink
rewrite to match
Browse files Browse the repository at this point in the history
Signed-off-by: Jegor Popow <juicedogegor@gmail.com>
  • Loading branch information
jegorpopow committed May 9, 2024
1 parent fd750ba commit c988546
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/typed/Match_Bool.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,22 @@ let run _ fallback =
Pprintast.longident
id2
(expr2string rhs2); *)
if List.equal String.equal (Longident.flatten id1) [ "true" ]
&& List.equal String.equal (Longident.flatten id2) [ "false" ]
then
match Longident.flatten id1, Longident.flatten id2 with
| [ "true" ], [ "false" ] ->
CollectedLints.add
~loc
(report
loc.Location.loc_start.Lexing.pos_fname
~loc
{ expr with exp_desc = Texp_ifthenelse (scru, rhs1, Some rhs2) });
if List.equal String.equal (Longident.flatten id1) [ "false" ]
&& List.equal String.equal (Longident.flatten id2) [ "true" ]
then
{ expr with exp_desc = Texp_ifthenelse (scru, rhs1, Some rhs2) })
| [ "false" ], [ "true" ] ->
CollectedLints.add
~loc
(report
loc.Location.loc_start.Lexing.pos_fname
~loc
{ expr with exp_desc = Texp_ifthenelse (scru, rhs2, Some rhs1) }))
{ expr with exp_desc = Texp_ifthenelse (scru, rhs2, Some rhs1) })
| _ -> ())
();
fallback.expr self expr)
}
Expand Down

0 comments on commit c988546

Please sign in to comment.