You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a match clause only has 2 cases, and the last case is _, then the whole thing can be converted into a simple if-then-else block, which is more readable.
Test1:
match foo with
| bar -> ()
| _ -> ()
Should throw warnings.
Test2:
match foo with
| bar -> ()
| baz -> ()
| _ -> ()
Should not throw warnings (because it has 3 cases, not 2).
Test3:
match foo with
| bar -> ()
| baz -> ()
Should not throw warnings (because its last case is not _).
Test4:
match foo with
| Bar baz -> ()
| _ -> ()
Should not throw warnings (because its first case is not a single element, so the casting is useful).