Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend code action that expands catch all #988

Merged
merged 2 commits into from
May 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
set mode properly
  • Loading branch information
zth committed May 26, 2024
commit 1636515f3d91e48d26d1da9670c79bc6e77642cb
8 changes: 5 additions & 3 deletions analysis/src/Xform.ml
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,11 @@ module ExpandCatchAllForVariants = struct
@ constructorNames
| _ -> constructorNames
in
let getCurrentConstructorNames cases =
let getCurrentConstructorNames ?mode cases =
cases
|> List.map (fun (c : Parsetree.case) ->
if Option.is_some c.pc_guard then []
else findAllConstructorNames ~mode:`option c.pc_lhs)
else findAllConstructorNames ?mode c.pc_lhs)
|> List.flatten
in
let currentConstructorNames = getCurrentConstructorNames cases in
Expand Down Expand Up @@ -481,7 +481,9 @@ module ExpandCatchAllForVariants = struct
in
match innerType with
| Some ((Tvariant _ | Tpolyvariant _) as variant) ->
let currentConstructorNames = getCurrentConstructorNames cases in
let currentConstructorNames =
getCurrentConstructorNames ~mode:`option cases
in
let hasNoneCase =
cases
|> List.exists (fun (c : Parsetree.case) ->
Expand Down
Loading