From c0023cdd719adfa1bc54acbaa831e8a3ec9ac5da Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Sun, 11 Oct 2026 13:46:16 +0200 Subject: [PATCH 1/2] Omit Weak.get_copy from tests in src/weak/lin_tests.ml --- src/weak/lin_tests.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/weak/lin_tests.ml b/src/weak/lin_tests.ml index 56c44db2..2eac3e61 100644 --- a/src/weak/lin_tests.ml +++ b/src/weak/lin_tests.ml @@ -15,7 +15,8 @@ struct [ val_ "Weak.length" Weak.length (t @-> returning int); val_ "Weak.set" Weak.set (t @-> int @-> option int64 @-> returning_or_exc unit); val_ "Weak.get" Weak.get (t @-> int @-> returning_or_exc (option int64)); - val_ "Weak.get_copy" Weak.get_copy (t @-> int @-> returning_or_exc (option int64)); + (* Weak.get_copy is considered dangerous and an alias for Weak.get since 5.6 https://github.com/ocaml/ocaml/pull/15064 *) + (*val_ "Weak.get_copy" Weak.get_copy (t @-> int @-> returning_or_exc (option int64)); *) val_ "Weak.check" Weak.check (t @-> int @-> returning_or_exc bool); val_ "Weak.fill" Weak.fill (t @-> int @-> int @-> option int64 @-> returning_or_exc unit); (*val blit : 'a t -> int -> 'a t -> int -> int -> unit *) From c423f3bea4ae06181b8f4f5fa84846eb69ba7c3b Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Sun, 11 Oct 2026 13:46:49 +0200 Subject: [PATCH 2/2] Omit Weak.get_copy from tests in src/weak/stm_tests_weak_spec.ml --- src/weak/stm_tests_weak_spec.ml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/weak/stm_tests_weak_spec.ml b/src/weak/stm_tests_weak_spec.ml index 8c81a743..44899e89 100644 --- a/src/weak/stm_tests_weak_spec.ml +++ b/src/weak/stm_tests_weak_spec.ml @@ -7,7 +7,8 @@ type cmd = | Length | Set of int * data option | Get of int - | Get_copy of int +(* Weak.get_copy is considered dangerous and an alias for Weak.get since 5.6 https://github.com/ocaml/ocaml/pull/15064 *) +(*| Get_copy of int *) | Check of int | Fill of int * int * data option and data = string @@ -18,7 +19,7 @@ let pp_cmd par fmt x = | Length -> cst0 "Length" fmt | Set (x, y) -> cst2 pp_int (pp_option pp_string) "Set" par fmt x y | Get x -> cst1 pp_int "Get" par fmt x - | Get_copy x -> cst1 pp_int "Get_copy" par fmt x +(*| Get_copy x -> cst1 pp_int "Get_copy" par fmt x *) | Check x -> cst1 pp_int "Check" par fmt x | Fill (x, y, z) -> cst3 pp_int pp_int (pp_option pp_string) "Fill" par fmt x y z @@ -32,7 +33,7 @@ let _shrink_cmd c = match c with | Length -> Iter.empty | Set (i, d_opt) -> Iter.map (fun i -> Set (i,d_opt)) (Shrink.int i) | Get i -> Iter.map (fun i -> Get i) (Shrink.int i) - | Get_copy i -> Iter.map (fun i -> Get_copy i) (Shrink.int i) +(*| Get_copy i -> Iter.map (fun i -> Get_copy i) (Shrink.int i) *) | Check i -> Iter.map (fun i -> Check i) (Shrink.int i) | Fill (i,j,d_opt) -> Iter.(map (fun i -> Fill (i,j,d_opt)) (Shrink.int i) @@ -47,7 +48,7 @@ let arb_cmd s = [ 1,return Length; 1,map2 (fun i d_opt -> Set (i,d_opt)) int_gen (option data_gen); 2,map (fun i -> Get i) int_gen; - 2,map (fun i -> Get_copy i) int_gen; + (*2,map (fun i -> Get_copy i) int_gen; *) 2,map (fun i -> Check i) int_gen; 2,map3 (fun i len d_opt -> Fill (i,len,d_opt)) int_gen int_gen (option data_gen); (* hack: reusing int_gen for length *) ]) @@ -61,7 +62,7 @@ let next_state c s = match c with | Set (i,d_opt) -> List.mapi (fun j d_opt' -> if i=j then d_opt else d_opt') s | Get _ -> s - | Get_copy _ -> s +(*| Get_copy _ -> s *) | Check _ -> s | Fill (i,l,d_opt) -> if i >= 0 && l >= 0 && i+l-1 < List.length s @@ -78,7 +79,7 @@ let run c a = match c with | Length -> Res (int, Weak.length a) | Set (i,d_opt) -> Res (result unit exn, protect (fun () -> Weak.set a i d_opt) ()) | Get i -> Res (result (option string) exn, protect (fun () -> Weak.get a i) ()) - | Get_copy i -> Res (result (option string) exn, protect (fun () -> Weak.get_copy a i) ()) +(*| Get_copy i -> Res (result (option string) exn, protect (fun () -> Weak.get_copy a i) ()) *) | Check i -> Res (result bool exn, protect (fun () -> Weak.check a i) ()) | Fill (i,l,d_opt) -> Res (result unit exn, protect (fun () -> Weak.fill a i l d_opt) ()) @@ -92,10 +93,10 @@ let postcond c (s:state) res = match c, res with if i < 0 || i >= List.length s then r = Error (Invalid_argument "Weak.get") else r = Ok None || r = Ok (List.nth s i) - | Get_copy i, Res ((Result (Option String,Exn),_), r) -> +(*| Get_copy i, Res ((Result (Option String,Exn),_), r) -> if i < 0 || i >= List.length s then r = Error (Invalid_argument "Weak.get_copy") - else r = Ok None || r = Ok (List.nth s i) + else r = Ok None || r = Ok (List.nth s i) *) | Check i, Res ((Result (Bool,Exn),_),r) -> if i < 0 || i >= List.length s then r = Error (Invalid_argument "Weak.check")