Skip to content

Commit 858a66a

Browse files
v0.18~preview.130.106+341
1 parent f861c92 commit 858a66a

410 files changed

Lines changed: 1222 additions & 38355 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

base.opam

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ depends: [
2323
"sexplib0"
2424
"dune" {>= "3.17.0"}
2525
"dune-configurator"
26-
"ppxlib" {= "0.33.0+ox"}
26+
"ppxlib" {>= "0.33.0" & < "0.36.0"}
2727
]
2828
available: arch != "x86_32"
29+
conflicts: [
30+
"oxcaml-compiler" {< "5.2.0minus39"}
31+
]
2932
synopsis: "Full standard library replacement for OCaml"
3033
description: "
3134
Full standard library replacement for OCaml

dune

Whitespace-only changes.

ppx/test/dune

Whitespace-only changes.

ppx/test/test.mlt

Lines changed: 0 additions & 29 deletions
This file was deleted.

shadow-stdlib/gen/gen.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let () =
1919
let pp = Format.formatter_of_buffer buf in
2020
Format.pp_set_margin pp max_int;
2121
(* so we can parse line by line below *)
22-
Format.fprintf pp "%a@." Printtyp.Compat.signature cmi.Cmi_format.cmi_sign;
22+
Format.fprintf pp "%a@." Printtyp.Compat.signature (fst cmi.Cmi_format.cmi_sign);
2323
let s = Buffer.contents buf in
2424
let lines = Str.split (Str.regexp "\n") s in
2525
Printf.fprintf oc "[@@@warning \"-3\"]\n\n";

src/array.ml

Lines changed: 45 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ module Option = Option0
66
module List = List0
77
include Array
88

9-
[@@@warning "-incompatible-with-upstream"]
10-
119
type ('a : any mod separable) t = 'a array
1210

1311
[%%template
@@ -48,7 +46,8 @@ type%template ('a : k) t = 'a array
4846
- http://www.sorting-algorithms.com/quick-sort-3-way *)
4947

5048
module%template.portable
51-
[@kind k = base_or_null_with_ext] [@modality p] Sorter (S : sig
49+
[@kind k = (base_or_null_with_ext, value_or_null mod external64 non_float)]
50+
[@modality p] Sorter (S : sig
5251
[@@@kind k = k mod separable]
5352

5453
type ('a : k) t
@@ -330,7 +329,8 @@ struct
330329
end
331330
[@@inline]
332331

333-
module%template [@kind k = base_or_null_with_ext] Sort =
332+
module%template
333+
[@kind k = (base_or_null_with_ext, value_or_null mod external64 non_float)] Sort =
334334
Sorter [@kind k] [@modality portable] (struct
335335
type nonrec ('a : k mod separable) t = 'a t
336336

@@ -820,34 +820,6 @@ let filteri t ~f =
820820
(filter_mapi [@kind k1 k1]) t ~f:(fun i x -> if f i x then Some x else None) [@nontail]
821821
;;
822822

823-
[%%template
824-
[@@@kind.default k1 = k1, k2 = base_or_null, k3 = base_or_null]
825-
826-
let foldi_until t ~init ~f ~finish =
827-
let length = length t in
828-
let rec loop i acc =
829-
if i < length
830-
then (
831-
match
832-
((f [@inlined hint]) i acc (unsafe_get t i)
833-
: (_ Container.Continue_or_stop.t
834-
[@kind (k2 or value_or_null) (k3 or value_or_null)]))
835-
with
836-
| Continue acc -> loop (i + 1) acc
837-
| Stop res -> res)
838-
else finish i acc
839-
in
840-
(loop [@inlined]) 0 init [@nontail]
841-
;;
842-
843-
let fold_until t ~init ~f ~finish =
844-
(foldi_until [@kind k1 k2 k3] [@inlined])
845-
t
846-
~init
847-
~f:(fun _i acc x -> f acc x)
848-
~finish:(fun _i acc -> finish acc) [@nontail]
849-
;;]
850-
851823
[@@@kind.default k2 = base_or_null_with_ext]
852824

853825
let of_list_rev_map xs ~f =
@@ -860,36 +832,58 @@ let of_list_rev_mapi xs ~f =
860832
let t = (of_list_mapi [@kind k1 k2]) xs ~f in
861833
(rev_inplace [@kind k2]) t;
862834
t
863-
;;
835+
;;]
864836

865-
[@@@kind.default k3 = base_or_null_with_ext]
837+
[%%template
838+
[@@@kind.default k = base_or_null_with_ext]
866839

867840
let partition_mapi t ~f =
868-
let (both : (_ Either0.t[@kind (k2 or value_or_null) (k3 or value_or_null)]) t) =
869-
(mapi [@kind k1 value_or_null]) t ~f
841+
let (both : (_ Either0.t[@kind (k or value_or_null) (k or value_or_null)]) t) =
842+
(mapi [@kind k value_or_null]) t ~f
870843
in
871844
let firsts =
872-
(filter_map [@kind value_or_null k2]) both ~f:(function
873-
| First x -> (Some x : (_ Option.t[@kind k2 or value_or_null]))
845+
(filter_map [@kind value_or_null k]) both ~f:(function
846+
| First x -> (Some x : (_ Option.t[@kind k or value_or_null]))
874847
| Second _ -> None)
875848
in
876849
let seconds =
877-
(filter_map [@kind value_or_null k3]) both ~f:(function
878-
| First _ -> (None : (_ Option.t[@kind k3 or value_or_null]))
850+
(filter_map [@kind value_or_null k]) both ~f:(function
851+
| First _ -> (None : (_ Option.t[@kind k or value_or_null]))
879852
| Second x -> Some x)
880853
in
881854
firsts, seconds
855+
;;]
856+
857+
let partition_map t ~f = partition_mapi t ~f:(fun _ x -> f x) [@nontail]
858+
859+
let foldi_until t ~init ~f ~finish =
860+
let length = length t in
861+
let rec loop i acc =
862+
if i < length
863+
then (
864+
match
865+
((f [@inlined hint]) i acc (unsafe_get t i) : _ Container.Continue_or_stop.t)
866+
with
867+
| Continue acc -> loop (i + 1) acc
868+
| Stop res -> res)
869+
else finish i acc
870+
in
871+
(loop [@inlined]) 0 init [@nontail]
882872
;;
883873

884-
let partition_map t ~f =
885-
(partition_mapi [@kind k1 k2 k3]) t ~f:(fun _ x -> f x) [@nontail]
886-
;;]
874+
let fold_until t ~init ~f ~finish =
875+
(foldi_until [@inlined])
876+
t
877+
~init
878+
~f:(fun _i acc x -> f acc x)
879+
~finish:(fun _i acc -> finish acc) [@nontail]
880+
;;
887881

888882
[%%template
889883
[@@@kind.default k = base_or_null_with_ext]
890884

891885
let partitioni_tf t ~f =
892-
(partition_mapi [@kind k k k]) t ~f:(fun i x -> if f i x then First x else Second x)
886+
(partition_mapi [@kind k]) t ~f:(fun i x -> if f i x then First x else Second x)
893887
[@nontail]
894888
;;
895889

@@ -1181,8 +1175,6 @@ let transpose_exn tt =
11811175
| Some tt' -> tt'
11821176
;;
11831177

1184-
[@@@warning "-incompatible-with-upstream"]
1185-
11861178
let%template[@kind k1 = base_or_null_with_ext, k2 = base_or_null_with_ext] map t ~f =
11871179
(map [@kind k1 k2]) t ~f
11881180
;;
@@ -1239,9 +1231,14 @@ let sub t ~pos ~len = sub t ~pos ~len
12391231
let invariant invariant_a t = iter t ~f:invariant_a
12401232

12411233
module Private = struct
1242-
module%template [@kind k = base_or_null_with_ext] Sort = Sort [@kind k]
1234+
module%template
1235+
[@kind k = (base_or_null_with_ext, value_or_null mod external64 non_float)] Sort =
1236+
Sort
1237+
[@kind k]
12431238

1244-
module%template.portable [@kind k = base_or_null_with_ext] [@modality p] Sorter =
1239+
module%template.portable
1240+
[@kind k = (base_or_null_with_ext, value_or_null mod external64 non_float)]
1241+
[@modality p] Sorter =
12451242
Sorter
12461243
[@kind k]
12471244
[@modality p]

src/array0.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
[Array.set]. Defining [module Array = Array0] is also necessary because it prevents
99
ocamldep from mistakenly causing a file to depend on [Base.Array]. *)
1010

11-
[@@@warning "-incompatible-with-upstream"]
12-
1311
open! Import0
1412
module Sys = Sys0
1513

src/array0.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
@@ portable
22

3-
[@@@warning "-incompatible-with-upstream"]
4-
53
[%%template:
64
external create
75
: ('a : any mod separable).

src/array_intf.ml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ open! Import
44
module Option = Option0
55
module List = List0.Constructors
66

7-
[@@@warning "-incompatible-with-upstream"]
8-
97
[%%template
108
[@@@kind_set.define base_or_null_with_ext = (base_or_null, value_or_null mod external64)]
119

@@ -116,7 +114,7 @@ module Definitions = struct
116114
[%%template:
117115
external create
118116
: ('a : any mod separable).
119-
len:int -> 'a -> 'a array @ m
117+
len:int -> 'a -> 'a array @ m unique
120118
= "%makearray_dynamic"
121119
[@@ocaml.doc
122120
{| [create ~len x] creates an array of length [len] with the value [x] populated in
@@ -126,7 +124,7 @@ module Definitions = struct
126124

127125
external create_local
128126
: ('a : any mod separable).
129-
len:int -> 'a -> 'a array @ local
127+
len:int -> 'a -> 'a array @ local unique
130128
= "%makearray_dynamic"
131129
[@@ocaml.doc
132130
{| [create_local ~len x] is like [create]. It allocates the array on the local
@@ -541,7 +539,7 @@ module type Array = sig @@ portable
541539
end
542540

543541
module%template.portable
544-
[@kind k = base_or_null_with_ext] Sorter (S : sig
542+
[@kind k = (base_or_null_with_ext, value_or_null mod external64 non_float)] Sorter (S : sig
545543
[@@@kind k = k mod separable]
546544

547545
type ('a : k) t

src/avltree.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ let rec add t ~replace ~compare ~added ~key:k ~data:v =
224224
if !added then (balance [@kind k v]) t else t)
225225
;;
226226

227-
let[@kind k = k, v = v, a = all, b = all, r = all]
227+
let[@kind k = k, v = v, a = value_or_null, b = value_or_null, r = (v, value_or_null)]
228228
[@mode c = (uncontended, shared)]
229229
[@inline always] rec findi_and_call_impl
230230
: type (k : k mod c) (v : v) (a : a) (b : b) (r : r) if_ in_.
@@ -265,9 +265,9 @@ let[@kind k = k, v = v, a = all, b = all, r = all]
265265

266266
[%%template
267267
[@@@mode.default c = (uncontended, shared)]
268-
[@@@kind r = all]
268+
[@@@kind r = v]
269269

270-
let[@kind k = k, v = v, r = r] find_and_call =
270+
let[@kind k = k, v = v, r = (r, value_or_null)] find_and_call =
271271
let call_if_found ~if_found ~key:_ ~data () () = if_found data in
272272
let call_if_not_found ~if_not_found key () () = if_not_found key in
273273
fun (t @ c) ~compare k ~if_found ~if_not_found ->
@@ -299,7 +299,7 @@ let[@kind k = k, v = v, r = r] findi_and_call =
299299
~if_not_found
300300
;;
301301

302-
[@@@kind a = all]
302+
[@@@kind a = value_or_null]
303303

304304
let[@kind k = k, v = v, a = a, r = r] find_and_call1 =
305305
let call_if_found ~if_found ~key:_ ~data arg () = if_found data arg in
@@ -333,7 +333,7 @@ let[@kind k = k, v = v, a = a, r = r] findi_and_call1 =
333333
~if_not_found
334334
;;
335335

336-
[@@@kind b = all]
336+
[@@@kind b = value_or_null]
337337

338338
let[@kind k = k, v = v, a = a, b = b, r = r] find_and_call2 =
339339
let call_if_found ~if_found ~key:_ ~data arg1 arg2 = if_found data arg1 arg2 in

0 commit comments

Comments
 (0)