fix: join_array on arrays of length=1 had a bound error

This commit is contained in:
Simon Cruanes 2023-06-15 11:42:13 -04:00
parent c8235f463d
commit d60bf3828b
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -285,7 +285,7 @@ let join_container_ ~iter ~map ~len cont : _ t =
let join_array (a : _ t array) : _ array t =
match Array.length a with
| 0 -> return [||]
| 1 -> map ?on:None a.(1) ~f:(fun x -> [| x |])
| 1 -> map ?on:None a.(0) ~f:(fun x -> [| x |])
| _ -> join_container_ ~len:Array.length ~map:Array.map ~iter:Array.iter a
let join_list (l : _ t list) : _ list t =