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 <shuntian.liu2@cloud.com>
  • Loading branch information
Vincent-lau committed Feb 28, 2024
1 parent cbcdec7 commit 403451c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lib/pythongen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,13 @@ 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
| [] -> []
| variants_to_check ->
List.fold_left
(fun acc x -> List.concat [ acc; check false x ])
(check true (List.hd variants_to_check))
(List.tl variants_to_check)
in
let all_tags = List.map (fun (BoxedTag t) -> t.tname) variants in
let pylist =
Expand Down

0 comments on commit 403451c

Please sign in to comment.