Skip to content

Commit

Permalink
Check for list emptiness before checking variants
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Liu <[email protected]>
  • Loading branch information
Vincent-lau committed Feb 29, 2024
1 parent cbcdec7 commit 6cacde3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib/pythongen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,12 @@ let rec typecheck : type a. a typ -> string -> t list =
variants
in
let check_contents =
List.fold_left
(fun acc x -> List.concat [ acc; check false x ])
(check true (List.hd variants_to_check))
(List.tl variants_to_check)
match variants_to_check with
| [] -> []
| v :: vs ->
List.fold_left
(fun acc x -> List.concat [ acc; check false x ])
(check true v) vs
in
let all_tags = List.map (fun (BoxedTag t) -> t.tname) variants in
let pylist =
Expand Down

0 comments on commit 6cacde3

Please sign in to comment.