ocamlPackages.janestreet: 0.15 -> 0.16 (#247022)

This commit is contained in:
Dimitrije Radojević 2023-08-31 06:46:20 +01:00 committed by GitHub
parent e6eee3ee22
commit 9b4d043ba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1771 additions and 25 deletions

View File

@ -87,6 +87,10 @@ in
then [
./janestreet-0.15.patch
]
else if version == "8.17.0+0.17.0"
then [
./janestreet-0.16.patch
]
else [
];

View File

@ -0,0 +1,17 @@
diff --git a/serlib/ser_stdlib.ml b/serlib/ser_stdlib.ml
index 894d300..11c9217 100644
--- a/serlib/ser_stdlib.ml
+++ b/serlib/ser_stdlib.ml
@@ -28,6 +28,7 @@ let ref_to_yojson f x = f !x
let ref_of_yojson f x = Result.map (fun x -> ref x) (f x)
let hash_fold_ref = hash_fold_ref_frozen
let compare_ref = compare_ref
+let (==) x y = (==) x y
module Lazy = struct
type 'a t = 'a lazy_t
@@ -35,3 +36,4 @@ module Lazy = struct
end
module Option = Stdlib.Option
+module List = Stdlib.List

View File

@ -29,6 +29,8 @@ buildDunePackage rec {
sha256 = "0g11324j1s2631zzf7zxc8s0nqd4fwvcni0kbvfpfxg96gy2wwfm";
};
patches = [ ./janestreet-0.16.patch ];
propagatedBuildInputs = [
base64
bos

View File

@ -0,0 +1,205 @@
diff --git a/lib/engine/scheduler.ml b/lib/engine/scheduler.ml
index e32bd0f..93b566b 100644
--- a/lib/engine/scheduler.ml
+++ b/lib/engine/scheduler.ml
@@ -601,7 +601,7 @@ module Make(Backend : Backend) = struct
)
)
| Trywith tw -> (
- match Table.find sched.traces (Workflow.id tw.w) with
+ match Hashtbl.find sched.traces (Workflow.id tw.w) with
| Some eventual_trace -> (
eventual_trace >>= function
| Ok (Run r) ->
@@ -667,10 +667,10 @@ module Make(Backend : Backend) = struct
let register_build sched ~id ~build_trace =
let open Eval_thread.Infix in
(
- match Table.find sched.traces id with
+ match Hashtbl.find sched.traces id with
| None ->
let trace = build_trace () in
- Table.set sched.traces ~key:id ~data:trace ;
+ Hashtbl.set sched.traces ~key:id ~data:trace ;
trace
| Some trace -> trace
) >>= fun trace ->
@@ -854,7 +854,7 @@ module Make(Backend : Backend) = struct
Eval_thread.join l.elts ~f:(build ?target sched)
| Trywith tw -> (
build sched ?target tw.w >> fun w_result ->
- match Table.find sched.traces (Workflow.id tw.w) with
+ match Hashtbl.find sched.traces (Workflow.id tw.w) with
| Some eventual_trace -> (
eventual_trace >> function
| Ok (Run r) when run_trywith_recovery r.details ->
diff --git a/lib/multinode/bistro_multinode.ml b/lib/multinode/bistro_multinode.ml
index 01dc5ac..3fc6b0e 100644
--- a/lib/multinode/bistro_multinode.ml
+++ b/lib/multinode/bistro_multinode.ml
@@ -130,7 +130,7 @@ module Server = struct
let search (type s) (table : s String.Table.t) ~f =
let module M = struct exception Found of string * s end in
try
- String.Table.fold table ~init:() ~f:(fun ~key ~data () -> if f ~key ~data then raise (M.Found (key, data))) ;
+ Hashtbl.fold table ~init:() ~f:(fun ~key ~data () -> if f ~key ~data then raise (M.Found (key, data))) ;
None
with M.Found (k, v) -> Some (k, v)
@@ -145,7 +145,7 @@ module Server = struct
match allocation_attempt with
| None -> Some elt
| Some (worker_id, (Resource curr)) ->
- String.Table.set pool.available ~key:worker_id ~data:(Resource { np = curr.np - np ; mem = curr.mem - mem }) ;
+ Hashtbl.set pool.available ~key:worker_id ~data:(Resource { np = curr.np - np ; mem = curr.mem - mem }) ;
Lwt.wakeup u (worker_id, Resource { np ; mem }) ;
None
)
@@ -163,12 +163,12 @@ module Server = struct
t
let add_worker pool (Worker { id ; np ; mem ; _ }) =
- match String.Table.add pool.available ~key:id ~data:(Allocator.Resource { np ; mem }) with
+ match Hashtbl.add pool.available ~key:id ~data:(Allocator.Resource { np ; mem }) with
| `Ok -> allocation_pass pool
| `Duplicate -> failwith "A worker has been added twice"
let release pool worker_id (Allocator.Resource { np ; mem }) =
- String.Table.update pool.available worker_id ~f:(function
+ Hashtbl.update pool.available worker_id ~f:(function
| None -> failwith "Tried to release resources of inexistent worker"
| Some (Resource r) -> Resource { np = r.np + np ; mem = r.mem + mem }
)
@@ -235,13 +235,13 @@ module Server = struct
| Subscript { np ; mem } ->
let id = new_id () in
let w = create_worker ~np ~mem id in
- String.Table.set state.workers ~key:id ~data:w ;
+ Hashtbl.set state.workers ~key:id ~data:w ;
Worker_allocator.add_worker state.alloc w ;
log (Logger.Debug (sprintf "new worker %s" id)) ;
Lwt.return (Client_id id)
| Get_job { client_id } -> (
- match String.Table.find state.workers client_id with
+ match Hashtbl.find state.workers client_id with
| None -> Lwt.return None
| Some (Worker worker) ->
Lwt.choose [
@@ -250,22 +250,22 @@ module Server = struct
] >>= function
| `Job wp ->
let workflow_id = workflow_id_of_job_waiter wp in
- String.Table.set worker.running_jobs ~key:workflow_id ~data:wp ;
+ Hashtbl.set worker.running_jobs ~key:workflow_id ~data:wp ;
Lwt.return (Some (job_of_job_waiter wp))
| `Stop -> Lwt.return None
)
| Plugin_result r ->
- let Worker worker = String.Table.find_exn state.workers r.client_id in
+ let Worker worker = Hashtbl.find_exn state.workers r.client_id in
Lwt.return (
- match String.Table.find_exn worker.running_jobs r.workflow_id with
+ match Hashtbl.find_exn worker.running_jobs r.workflow_id with
| Waiting_plugin wp -> Lwt.wakeup wp.waiter r.result
| Waiting_shell_command _ -> assert false (* should never happen *)
)
| Shell_command_result r ->
- let Worker worker = String.Table.find_exn state.workers r.client_id in
+ let Worker worker = Hashtbl.find_exn state.workers r.client_id in
Lwt.return (
- match String.Table.find_exn worker.running_jobs r.workflow_id with
+ match Hashtbl.find_exn worker.running_jobs r.workflow_id with
| Waiting_plugin _ -> assert false (* should never happen *)
| Waiting_shell_command wp -> Lwt.wakeup wp.waiter r.result
)
@@ -307,7 +307,7 @@ module Server = struct
let request_resource backend req =
Worker_allocator.request backend.state.alloc req >|= fun (worker_id, resource) ->
- String.Table.find_exn backend.state.workers worker_id, resource
+ Hashtbl.find_exn backend.state.workers worker_id, resource
let release_resource backend worker_id res =
Worker_allocator.release backend.state.alloc worker_id res
@@ -334,7 +334,7 @@ module Server = struct
* loop () *)
let eval backend { worker_id ; workflow_id } f x =
- let Worker worker = String.Table.find_exn backend.state.workers worker_id in
+ let Worker worker = Hashtbl.find_exn backend.state.workers worker_id in
let f () = f x in
let t, u = Lwt.wait () in
let job_waiter = Waiting_plugin { waiter = u ; f ; workflow_id } in
@@ -342,7 +342,7 @@ module Server = struct
t
let run_shell_command backend { worker_id ; workflow_id } cmd =
- let Worker worker = String.Table.find_exn backend.state.workers worker_id in
+ let Worker worker = Hashtbl.find_exn backend.state.workers worker_id in
let t, u = Lwt.wait () in
let job = Waiting_shell_command { waiter = u ; cmd ; workflow_id } in
Lwt_queue.push worker.pending_jobs job ;
diff --git a/lib/utils/dot_output.ml b/lib/utils/dot_output.ml
index 90c299f..d13fceb 100644
--- a/lib/utils/dot_output.ml
+++ b/lib/utils/dot_output.ml
@@ -24,7 +24,7 @@ module G = struct
(* let successors g u = fold_succ (fun h t -> h :: t) g u [] *)
let rec of_workflow_aux seen acc u =
- if S.mem seen u then (seen, acc)
+ if Set.mem seen u then (seen, acc)
else (
let deps = W.Any.deps u in
let seen, acc =
@@ -34,7 +34,7 @@ module G = struct
in
let acc = add_vertex acc u in
let acc = List.fold deps ~init:acc ~f:(fun acc v -> add_edge acc u v) in
- let seen = S.add seen u in
+ let seen = Set.add seen u in
seen, acc
)
@@ -109,7 +109,7 @@ let dot_output ?db oc g ~needed =
]
in
let vertex_attributes u =
- let needed = (match db with None -> true | Some _ -> false) || S.mem needed u in
+ let needed = (match db with None -> true | Some _ -> false) || Set.mem needed u in
let color = if needed then black else light_gray in
let shape = `Shape (shape u) in
let W.Any w = u in
@@ -141,7 +141,7 @@ let dot_output ?db oc g ~needed =
| _ -> []
in
let color =
- if (match db with None -> true | Some _ -> false) || (S.mem needed u && not (already_done u))
+ if (match db with None -> true | Some _ -> false) || (Set.mem needed u && not (already_done u))
then black else light_gray in
style @ [ `Color color ]
in
diff --git a/lib/utils/repo.ml b/lib/utils/repo.ml
index 06abcd5..206a99e 100644
--- a/lib/utils/repo.ml
+++ b/lib/utils/repo.ml
@@ -160,7 +160,7 @@ let protected_set repo =
| Select s -> fold_path_workflow acc (W.Any s.dir)
| Input _ -> acc
| Shell _
- | Plugin _ -> String.Set.add acc (W.id w)
+ | Plugin _ -> Set.add acc (W.id w)
| Trywith tw ->
fold_path_workflow (fold_path_workflow acc (W.Any tw.w)) (W.Any tw.failsafe)
| Ifelse ie ->
@@ -187,7 +187,7 @@ let cache_clip_fold ~bistro_dir repo ~f ~init =
let protected = protected_set repo in
let db = Db.init_exn bistro_dir in
Db.fold_cache db ~init ~f:(fun acc id ->
- f db acc (if String.Set.mem protected id then `Protected id else `Unprotected id)
+ f db acc (if Set.mem protected id then `Protected id else `Unprotected id)
)
let cache_clip_dry_run ~bistro_dir repo =

View File

@ -13,7 +13,7 @@ buildDunePackage rec {
hash = "sha256-iSg0QsTcU0MT/Cletl+hW6bKyH0jkp7Jixqu8H59UmQ=";
};
patches = [ ./git_commit.patch ];
patches = [ ./git_commit.patch ./janestreet-0.16.patch ];
strictDeps = true;

View File

@ -0,0 +1,36 @@
diff --git a/lib/CFStream_stream.ml b/lib/CFStream_stream.ml
index 25c0e5a..94da2e3 100644
--- a/lib/CFStream_stream.ml
+++ b/lib/CFStream_stream.ml
@@ -287,7 +287,7 @@ let group_aux xs map eq =
;;
let group xs ~f = group_aux xs f Poly.( = )
-let group_by xs ~eq = group_aux xs ident eq
+let group_by xs ~eq = group_aux xs Fn.id eq
let chunk2 xs =
from (fun _ ->
@@ -615,11 +615,11 @@ let to_hashtbl xs =
let of_map t = of_list (Map.to_alist t)
let to_map xs =
- fold xs ~init:Map.Poly.empty ~f:(fun accu (key, data) -> Map.Poly.set accu ~key ~data)
+ fold xs ~init:Map.Poly.empty ~f:(fun accu (key, data) -> Map.set accu ~key ~data)
;;
let of_set t = of_list (Set.to_list t)
-let to_set xs = fold xs ~init:Set.Poly.empty ~f:(fun accu e -> Set.Poly.add accu e)
+let to_set xs = fold xs ~init:Set.Poly.empty ~f:(fun accu e -> Set.add accu e)
module Infix = struct
let ( -- ) x y = range x ~until:y
@@ -660,7 +660,7 @@ module Result = struct
| M.E e -> Result.Error e
;;
- let all xs ~f = all_gen ident xs ~f
+ let all xs ~f = all_gen Fn.id xs ~f
let all' xs ~f = all_gen (fun x -> Ok x) xs ~f
let to_exn = result_to_exn

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
{ lib, fetchFromGitHub, buildDunePackage, defaultVersion ? "0.16" }:
{ pname
, version ? defaultVersion
, hash
, minimalOCamlVersion ? "4.14"
, doCheck ? true
, buildInputs ? []
, ...}@args:
buildDunePackage (args // {
duneVersion = "3";
inherit version buildInputs;
inherit minimalOCamlVersion;
src = fetchFromGitHub {
owner = "janestreet";
repo = pname;
rev = "v${version}";
sha256 = hash;
};
inherit doCheck;
meta = {
license = lib.licenses.mit;
homepage = "https://github.com/janestreet/${pname}";
} // args.meta;
})

View File

@ -5,8 +5,12 @@ buildDunePackage rec {
inherit (tls) src meta version;
minimalOCamlVersion = "4.11";
duneVersion = "3";
minimalOCamlVersion = "4.13";
patches = [
# Remove when TLS gets updated to v0.17.1.
./janestreet-0.16.patch
];
doCheck = true;

View File

@ -0,0 +1,23 @@
diff --git a/async/tls_async.mli b/async/tls_async.mli
index b4894b8..101f27f 100644
--- a/async/tls_async.mli
+++ b/async/tls_async.mli
@@ -55,4 +55,4 @@ val connect
-> 'addr Tcp.Where_to_connect.t
-> host:[ `host ] Domain_name.t option
-> (Session.t * Reader.t * Writer.t) Deferred.Or_error.t)
- Tcp.with_connect_options
+ Tcp.Aliases.with_connect_options
diff --git a/async/x509_async.ml b/async/x509_async.ml
index d4fad8c..4ee466a 100644
--- a/async/x509_async.ml
+++ b/async/x509_async.ml
@@ -9,7 +9,7 @@ let file_contents file =
let load_all_in_directory ~directory ~f =
let open Deferred.Or_error.Let_syntax in
let%bind files = Deferred.Or_error.try_with (fun () -> Sys.ls_dir directory) in
- Deferred.Or_error.List.map files ~f:(fun file ->
+ Deferred.Or_error.List.map ~how:`Sequential files ~f:(fun file ->
let%bind contents = file_contents (directory ^/ file) in
f ~contents)
;;

View File

@ -1,5 +1,5 @@
diff --git a/comby-kernel.opam b/comby-kernel.opam
index 9db7cc5..a497bff 100644
index 9db7cc5..83e6e7b 100644
--- a/comby-kernel.opam
+++ b/comby-kernel.opam
@@ -20,7 +20,7 @@ build: [
@ -7,7 +7,7 @@ index 9db7cc5..a497bff 100644
"dune" {>= "2.8.0"}
"ocaml" {>= "4.08.1"}
- "core_kernel"
+ "core_kernel" {>= "v0.15.0"}
+ "core-kernel" {>= "v0.16.0"}
"mparser" {>= "1.3"}
"mparser-pcre"
"ppx_deriving"
@ -25,7 +25,7 @@ index 88563f6..fbbc122 100644
"lwt"
"cohttp"
diff --git a/comby.opam b/comby.opam
index 9e5d96b..ecab789 100644
index 9e5d96b..d5be316 100644
--- a/comby.opam
+++ b/comby.opam
@@ -31,7 +31,7 @@ depends: [
@ -33,14 +33,23 @@ index 9e5d96b..ecab789 100644
"comby-kernel" {= "1.7.0"}
"comby-semantic" {= "1.7.0"}
- "core"
+ "core" {>= "v0.15.0"}
+ "core" {>= "v0.16.0"}
"hack_parallel" {arch != "arm32" & arch != "arm64"}
"lwt"
"lwt_react"
diff --git a/lib/app/configuration/command_configuration.ml b/lib/app/configuration/command_configuration.ml
index 75c3107..418276e 100644
index 75c3107..29826a9 100644
--- a/lib/app/configuration/command_configuration.ml
+++ b/lib/app/configuration/command_configuration.ml
@@ -1,7 +1,7 @@
open Core
open Camlzip
-open Polymorphic_compare
+open Poly
open Comby_kernel
@@ -16,21 +16,21 @@ type 'a next =
let fold_directory ?(sorted=false) root ~init ~f =
@ -356,6 +365,60 @@ index 7a6353d..b79cba2 100644
- (preprocess (pps ppx_jane)))
+ (preprocess
+ (pps ppx_jane)))
diff --git a/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml b/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml
index 4e064fb..dca77b2 100644
--- a/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml
+++ b/lib/app/vendored/patdiff/kernel/src/float_tolerance.ml
@@ -287,7 +287,7 @@ end = struct
~running_step:(fun (car, pos) cadr ->
match car, cadr with
| Same car_lines, Same cadr_lines ->
- Skip (Same (Array.concat [ car_lines; cadr_lines ]), pos)
+ Skip {state = (Same (Array.concat [ car_lines; cadr_lines ]), pos)}
| Unified _, _ | _, Unified _ ->
raise_s
[%message
@@ -296,7 +296,7 @@ end = struct
(cadr : string Range.t)]
| (Prev _ | Next _ | Replace _), (Prev _ | Next _ | Replace _)
| Same _, (Prev _ | Next _ | Replace _)
- | (Prev _ | Next _ | Replace _), Same _ -> Yield ((car, pos), (cadr, Middle)))
+ | (Prev _ | Next _ | Replace _), Same _ -> Yield {value = (car, pos); state = (cadr, Middle)})
~inner_finished:(fun (last, pos) ->
match last, pos with
| Unified _, _ ->
@@ -308,7 +308,7 @@ end = struct
Some (last, End))
~finishing_step:(function
| None -> Done
- | Some result -> Yield (result, None))
+ | Some result -> Yield {value = result; state = None})
;;
include struct
@@ -448,7 +448,7 @@ end = struct
~init:{ prev_start; next_start; ranges = [] }
~running_step:(fun t drop_or_keep ->
match (drop_or_keep : Drop_or_keep.t) with
- | Keep range -> Skip { t with ranges = range :: t.ranges }
+ | Keep range -> Skip {state = { t with ranges = range :: t.ranges }}
| Drop n ->
let hunk = to_hunk t in
let t =
@@ -457,11 +457,11 @@ end = struct
; ranges = []
}
in
- if List.is_empty (Hunk.ranges hunk) then Skip t else Yield (hunk, t))
+ if List.is_empty (Hunk.ranges hunk) then Skip {state = t} else Yield {value = hunk; state = t})
~inner_finished:(fun t -> if List.is_empty t.ranges then None else Some t)
~finishing_step:(function
| None -> Done
- | Some t -> Yield (to_hunk t, None))
+ | Some t -> Yield {value = to_hunk t; state = None})
;;
end
diff --git a/lib/app/vendored/patdiff/kernel/src/patdiff_core.ml b/lib/app/vendored/patdiff/kernel/src/patdiff_core.ml
index 4f53a0b..88ee0e3 100644
--- a/lib/app/vendored/patdiff/kernel/src/patdiff_core.ml
@ -501,7 +564,7 @@ index 03b120a..4d48b61 100644
+ ppx_deriving_yojson
+ ppx_deriving_yojson.runtime))
diff --git a/lib/kernel/matchers/alpha.ml b/lib/kernel/matchers/alpha.ml
index d6116f7..993aafc 100644
index d6116f7..7d16171 100644
--- a/lib/kernel/matchers/alpha.ml
+++ b/lib/kernel/matchers/alpha.ml
@@ -13,20 +13,11 @@ module R = MakeRegexp(Regexp)
@ -537,6 +600,15 @@ index d6116f7..993aafc 100644
List.fold plist ~init:(return Types.Unit) ~f:(>>)
let with_debug_matcher s tag =
@@ -745,7 +736,7 @@ module Make (Lang : Types.Language.S) (Meta : Types.Metasyntax.S) (Ext : Types.E
let hole_parser ?at_depth sort dimension =
let open Types.Hole in
let hole_parser =
- let open Polymorphic_compare in
+ let open Poly in
List.fold ~init:[] hole_parsers ~f:(fun acc (sort', parser) -> if sort' = sort then parser::acc else acc)
in
let skip_signal hole = skip (string "_signal_hole") |>> fun () -> Types.Hole hole in
diff --git a/lib/kernel/matchers/dune b/lib/kernel/matchers/dune
index 12ed326..4625458 100644
--- a/lib/kernel/matchers/dune
@ -566,7 +638,7 @@ index 12ed326..4625458 100644
+ yojson
+ ppx_deriving_yojson))
diff --git a/lib/kernel/matchers/evaluate.ml b/lib/kernel/matchers/evaluate.ml
index 9ea71a0..288f79a 100644
index 9ea71a0..4f63ab6 100644
--- a/lib/kernel/matchers/evaluate.ml
+++ b/lib/kernel/matchers/evaluate.ml
@@ -3,10 +3,7 @@ open Core_kernel
@ -581,8 +653,17 @@ index 9ea71a0..288f79a 100644
type result = bool * Match.environment option
@@ -102,7 +99,7 @@ let apply
|> Option.some
in
List.find_map cases ~f:(fun (template, case_expression) -> evaluate template case_expression)
- |> Option.value_map ~f:ident ~default:(false, Some env)
+ |> Option.value_map ~f:Fn.id ~default:(false, Some env)
(* rewrite ... { ... } *)
| Rewrite (Template t, (match_template, rewrite_template)) ->
diff --git a/lib/kernel/matchers/omega.ml b/lib/kernel/matchers/omega.ml
index 61cc69a..0bef682 100644
index 61cc69a..3445307 100644
--- a/lib/kernel/matchers/omega.ml
+++ b/lib/kernel/matchers/omega.ml
@@ -32,15 +32,9 @@ let push_source_ref : string ref = ref ""
@ -593,17 +674,25 @@ index 61cc69a..0bef682 100644
- match Sys.getenv "DEBUG_COMBY" with
- | exception Not_found -> false
- | _ -> true
-
+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some
-let rewrite =
- match Sys.getenv "REWRITE" with
- | exception Not_found -> false
- | _ -> true
+let debug = Sys.getenv "DEBUG_COMBY" |> Option.is_some
+
+let rewrite = Sys.getenv "REWRITE" |> Option.is_some
let actual = Buffer.create 10
@@ -540,7 +534,7 @@ module Make (Language : Types.Language.S) (Meta : Metasyntax.S) (Ext : External.
let hole_parser sort dimension : (production * 'a) t t =
let hole_parser = (* This must be fold, can't be find *)
- let open Polymorphic_compare in
+ let open Poly in
List.fold ~init:[] Template.Matching.hole_parsers ~f:(fun acc (sort', parser) ->
if sort' = sort then parser::acc else acc)
in
diff --git a/lib/kernel/matchers/preprocess.ml b/lib/kernel/matchers/preprocess.ml
index 84f3ed0..b6d10e7 100644
--- a/lib/kernel/matchers/preprocess.ml
@ -633,7 +722,7 @@ index ef0bd59..906820b 100644
module type Regexp_engine_intf = sig
type t
diff --git a/lib/kernel/matchers/rewrite.ml b/lib/kernel/matchers/rewrite.ml
index 32c4740..2fc28db 100644
index 32c4740..545cba5 100644
--- a/lib/kernel/matchers/rewrite.ml
+++ b/lib/kernel/matchers/rewrite.ml
@@ -4,10 +4,7 @@ open Core_kernel
@ -648,6 +737,35 @@ index 32c4740..2fc28db 100644
let counter =
let uuid_for_id_counter = ref 0 in
@@ -46,24 +43,24 @@ let parse_first_label ?(metasyntax = Metasyntax.default_metasyntax) template =
in
parse_string ~consume:All parser template
|> function
- | Ok label -> List.find_map label ~f:ident
+ | Ok label -> List.find_map label ~f:Fn.id
| Error _ -> None
let substitute_fresh
?(metasyntax = Metasyntax.default_metasyntax)
?(fresh = counter)
template =
- let label_table = String.Table.create () in
+ let label_table = Hashtbl.create (module String) in
let template_ref = ref template in
let current_label_ref = ref (parse_first_label ~metasyntax !template_ref) in
while Option.is_some !current_label_ref do
let label = Option.value_exn !current_label_ref in
let id =
- match String.Table.find label_table label with
+ match Hashtbl.find label_table label with
| Some id -> id
| None ->
let id = fresh () in
- if String.(label <> "") then String.Table.add_exn label_table ~key:label ~data:id;
+ if String.(label <> "") then Hashtbl.add_exn label_table ~key:label ~data:id;
id
in
let left, right = replacement_sentinel metasyntax in
diff --git a/lib/kernel/matchers/template.ml b/lib/kernel/matchers/template.ml
index 423a07f..136236c 100644
--- a/lib/kernel/matchers/template.ml

View File

@ -9829,6 +9829,7 @@ with pkgs;
ligo = callPackage ../development/compilers/ligo {
coq = coq_8_14;
ocamlPackages = ocaml-ng.ocamlPackages_4_14_janeStreet_0_15;
};
lego = callPackage ../tools/admin/lego { };
@ -17457,7 +17458,9 @@ with pkgs;
stalin = callPackage ../development/compilers/stalin { };
stanc = callPackage ../development/compilers/stanc { };
stanc = callPackage ../development/compilers/stanc {
ocamlPackages = ocaml-ng.ocamlPackages_4_14_janeStreet_0_15;
};
metaBuildEnv = callPackage ../development/compilers/meta-environment/meta-build-env { };

View File

@ -60,9 +60,7 @@ let
### B ###
bap = callPackage ../development/ocaml-modules/bap {
inherit (pkgs.llvmPackages) llvm;
};
bap = janeStreet_0_15.bap;
base64 = callPackage ../development/ocaml-modules/base64 { };
@ -86,7 +84,7 @@ let
biniou = callPackage ../development/ocaml-modules/biniou { };
biocaml = callPackage ../development/ocaml-modules/biocaml { };
biocaml = janeStreet_0_15.biocaml;
bisect_ppx = callPackage ../development/ocaml-modules/bisect_ppx { };
@ -718,7 +716,9 @@ let
# Jane Street
janePackage =
if lib.versionOlder "4.10.2" ocaml.version
if lib.versionOlder "4.13.1" ocaml.version
then callPackage ../development/ocaml-modules/janestreet/janePackage_0_16.nix {}
else if lib.versionOlder "4.10.2" ocaml.version
then callPackage ../development/ocaml-modules/janestreet/janePackage_0_15.nix {}
else if lib.versionOlder "4.08" ocaml.version
then callPackage ../development/ocaml-modules/janestreet/janePackage_0_14.nix {}
@ -727,7 +727,12 @@ let
else callPackage ../development/ocaml-modules/janestreet/janePackage.nix {};
janeStreet =
if lib.versionOlder "4.10.2" ocaml.version
if lib.versionOlder "4.13.1" ocaml.version
then import ../development/ocaml-modules/janestreet/0.16.nix {
inherit self;
inherit (pkgs) bash fetchpatch fzf lib openssl zstd;
}
else if lib.versionOlder "4.10.2" ocaml.version
then import ../development/ocaml-modules/janestreet/0.15.nix {
inherit self;
inherit (pkgs) bash fetchpatch fzf lib openssl zstd;
@ -751,6 +756,75 @@ let
inherit (pkgs) openssl;
};
janeStreet_0_15 = (lib.makeScope self.newScope (self': with self'; {
# ocamlPackages that janestreet v0.15 packages depend on.
jsDeps = let
uri-sexp = self.uri-sexp.override { inherit (self') ppx_sexp_conv sexplib0; };
cohttp = self.cohttp.override {
inherit (self') ppx_sexp_conv;
inherit uri-sexp;
};
ipaddr-sexp = self.ipaddr-sexp.override { inherit (self') ppx_sexp_conv; };
conduit = self.conduit.override {
inherit (self') ppx_sexp_conv sexplib;
inherit ipaddr-sexp;
};
conduit-async = self.conduit-async.override {
inherit (self') async ppx_sexp_conv ppx_here core sexplib async_ssl;
inherit conduit ipaddr-sexp;
};
in {
inherit (self) dune-configurator alcotest re num octavius uutf ounit ctypes;
ppxlib = self.ppxlib.override { inherit (self') stdio; };
cohttp-async = self.cohttp-async.override {
inherit (self') ppx_sexp_conv base async async_kernel async_unix core_unix sexplib0 core;
inherit uri-sexp cohttp conduit-async;
};
janePackage = callPackage ../development/ocaml-modules/janestreet/janePackage_0_15.nix { };
};
janeStreet = import ../development/ocaml-modules/janestreet/0.15.nix {
self = self' // jsDeps;
inherit (pkgs) bash fetchpatch fzf lib openssl zstd;
};
# Packages that are not part of janestreet libraries, but still depend
# on v0.15 are kept in this scope, too.
bap = let
ppxlib = jsDeps.ppxlib;
lwt_ppx = self.lwt_ppx.override { inherit ppxlib; };
sedlex = self.sedlex.override { inherit ppxlib ppx_expect; };
in callPackage ../development/ocaml-modules/bap {
inherit (pkgs.llvmPackages) llvm;
ezjsonm = self.ezjsonm.override { inherit sexplib0; };
ppx_bitstring = self.ppx_bitstring.override { inherit ppxlib; };
ocurl = self.ocurl.override { inherit lwt_ppx; };
piqi = self.piqi.override { inherit sedlex; };
piqi-ocaml = self.piqi-ocaml.override { inherit piqi; };
};
biocaml = let
angstrom = self.angstrom.override { inherit ppx_let; };
in callPackage ../development/ocaml-modules/biocaml {
uri = self.uri.override { inherit angstrom; };
cfstream = self.cfstream.override { inherit core_kernel; };
};
magic-trace = callPackage ../development/ocaml-modules/magic-trace { };
phylogenetics = let
angstrom = self.angstrom.override { inherit ppx_let; };
in callPackage ../development/ocaml-modules/phylogenetics {
inherit biocaml;
ppx_deriving = self.ppx_deriving.override { inherit (jsDeps) ppxlib; };
angstrom-unix = self.angstrom-unix.override { inherit angstrom; };
};
ppx_bap = callPackage ../development/ocaml-modules/ppx_bap { };
})).overrideScope' liftJaneStreet;
janeStreet_0_9_0 = import ../development/ocaml-modules/janestreet/old.nix {
self = self.janeStreet_0_9_0;
super = self // {
@ -930,7 +1004,7 @@ let
magic-mime = callPackage ../development/ocaml-modules/magic-mime { };
magic-trace = callPackage ../development/ocaml-modules/magic-trace { };
magic-trace = janeStreet_0_15.magic-trace;
mariadb = callPackage ../development/ocaml-modules/mariadb {
inherit (pkgs) mariadb;
@ -1332,7 +1406,7 @@ let
pgsolver = callPackage ../development/ocaml-modules/pgsolver { };
phylogenetics = callPackage ../development/ocaml-modules/phylogenetics { };
phylogenetics = janeStreet_0_15.phylogenetics;
piaf = callPackage ../development/ocaml-modules/piaf { };
@ -1366,7 +1440,7 @@ let
pprint = callPackage ../development/ocaml-modules/pprint { };
ppx_bap = callPackage ../development/ocaml-modules/ppx_bap { };
ppx_bap = janeStreet_0_15.ppx_bap;
ppx_bitstring = callPackage ../development/ocaml-modules/bitstring/ppx.nix { };
@ -1857,6 +1931,13 @@ in let inherit (pkgs) callPackage; in rec
ocamlPackages = ocamlPackages_4_14;
# This is a nasty way to replace toplevel janestreet attributes in the scope,
# so that modules outside of ocamlPackages that depend on JS OCaml libraries
# *and* non-JS OCaml libraries can pull in the same version of JS transitive
# dependencies. Remove this once ligo and stanc can be compiled against
# janestreet 0.16 libraries.
ocamlPackages_4_14_janeStreet_0_15 = ocamlPackages_4_14.overrideScope' (self: super: super // super.janeStreet_0_15);
# We still have packages that rely on unsafe-string, which is deprecated in OCaml 4.06.0.
# Below are aliases for porting them to the latest versions of the OCaml 4 series.
ocamlPackages_4_14_unsafe_string = mkOcamlPackages (callPackage ../development/compilers/ocaml/4.14.nix {