diff --git a/compiler/gen_OCaml.ml b/compiler/gen_OCaml.ml index b0b245f..d70b0c6 100644 --- a/compiler/gen_OCaml.ml +++ b/compiler/gen_OCaml.ml @@ -364,9 +364,7 @@ let rec default_value (ev_regime : Gencode.ev_regime) t = | Bitstring32 _ -> None | Sum (l, _) -> begin (* first constant constructor = default*) match - try - Some (List.find_map (function `Constant x -> Some x | _ -> None) l) - with Not_found -> None + List.find_map_opt (function `Constant x -> Some x | _ -> None) l with | None -> None | Some c -> diff --git a/opam b/opam index 7adc9cf..67a7e70 100644 --- a/opam +++ b/opam @@ -24,6 +24,6 @@ depends: [ "ocamlfind" {build} "ounit" {test} "camlp4" {build} - ("extlib" | "extlib-compat") + ("extlib" {>= "1.7.7"} | "extlib-compat" {>="1.7.7"}) "base-bytes" ] diff --git a/runtime/error.ml b/runtime/error.ml index 84f143c..8d7d3f8 100644 --- a/runtime/error.ml +++ b/runtime/error.ml @@ -28,9 +28,9 @@ let rec pp_location pp = function | Field (field, loc) -> PP.fprintf pp "@[<1>%s.@,%a@]" field pp_location loc | Message (msg, constr, loc) -> match constr with - None -> PP.fprintf pp "@[<1>%s.@,%a@]" (String.capitalize msg) pp_location loc + None -> PP.fprintf pp "@[<1>%s.@,%a@]" (String.capitalize_ascii msg) pp_location loc | Some c -> PP.fprintf pp "@[<1>%s_%s.@,%a@]" - (String.capitalize msg) (String.capitalize c) pp_location loc + (String.capitalize_ascii msg) (String.capitalize_ascii c) pp_location loc let pp_format_error pp = function | Bad_wire_type ty -> diff --git a/runtime/msg_buffer.ml b/runtime/msg_buffer.ml index c71bd12..397e986 100644 --- a/runtime/msg_buffer.ml +++ b/runtime/msg_buffer.ml @@ -108,7 +108,7 @@ let resize b more = let add_char b c = let pos = b.position in if pos >= b.length then resize b 1; - b.buffer.[pos] <- c; + Bytes.set b.buffer pos c; b.position <- pos + 1 let add_substring b s offset len = diff --git a/runtime/random_gen.ml b/runtime/random_gen.ml index fd69e12..6222a23 100644 --- a/runtime/random_gen.ml +++ b/runtime/random_gen.ml @@ -67,7 +67,7 @@ struct let s = Bytes.create n in let rec loop = function n when n < 0 -> return @@ Bytes.unsafe_to_string s - | n -> rand_integer 255 >>= fun c -> s.[n] <- Char.chr c; loop (n - 1) + | n -> rand_integer 255 >>= fun c -> Bytes.set s n (Char.chr c); loop (n - 1) in loop (n - 1) let rand_readable_string len = @@ -75,7 +75,7 @@ struct let s = Bytes.create n in let rec loop = function n when n < 0 -> return @@ Bytes.unsafe_to_string s - | n -> rand_integer (127 - 32) >>= fun c -> s.[n] <- Char.chr (32 + c); loop (n - 1) + | n -> rand_integer (127 - 32) >>= fun c -> Bytes.set s n (Char.chr (32 + c)); loop (n - 1) in loop (n - 1) let rand_int =