fix build for 4.11 by working around -nolabels

This commit is contained in:
Simon Cruanes 2020-07-30 10:02:16 -04:00
parent 8683153cc9
commit d60bea1a98
7 changed files with 55 additions and 53 deletions

View file

@ -14,7 +14,7 @@
(modes native) (modes native)
(modules run_qtest) (modules run_qtest)
; disable some warnings in qtests ; disable some warnings in qtests
(flags :standard -warn-error -a -w -3-33-35-27-39-50 -nolabels) (flags :standard -warn-error -a -w -3-33-35-27-39-50)
(libraries iter gen qcheck containers containers.unix unix uutf threads)) (libraries iter gen qcheck containers containers.unix unix uutf threads))
(alias (alias

View file

@ -10,6 +10,7 @@ let str_sub ?(offset=0) ~sub:s' s =
aux offset aux offset
let is_suffix ~sub s = let is_suffix ~sub s =
String.length s >= String.length sub &&
str_sub ~offset:(String.length s - String.length sub) ~sub s str_sub ~offset:(String.length s - String.length sub) ~sub s
let is_code file = is_suffix ~sub:".ml" file || is_suffix ~sub:".mli" file let is_code file = is_suffix ~sub:".ml" file || is_suffix ~sub:".mli" file
@ -22,6 +23,7 @@ let do_not_test file =
is_suffix ~sub:"mkflags.ml" file || is_suffix ~sub:"mkflags.ml" file ||
is_suffix ~sub:"mkshims.ml" file || is_suffix ~sub:"mkshims.ml" file ||
is_suffix ~sub:"unlabel.ml" file || is_suffix ~sub:"unlabel.ml" file ||
is_suffix ~sub:"check_labelled_mods.ml" file ||
is_suffix ~sub:"utop.ml" file is_suffix ~sub:"utop.ml" file
let prefix = "src" let prefix = "src"

View file

@ -713,19 +713,3 @@ module Infix = struct
end end
include Infix include Infix
(* test consistency of interfaces *)
(*$inject
module FA = CCShimsArray_.Floatarray
module type L = module type of CCArray with module Floatarray := FA
module type LL = module type of CCArrayLabels with module Floatarray := FA
*)
(*$R
ignore (module CCArrayLabels : L)
*)
(*$R
ignore (module CCArray : LL)
*)

View file

@ -1052,8 +1052,8 @@ let remove ~eq x l =
remove' eq x [] l remove' eq x [] l
(*$T (*$T
remove ~eq:CCInt.equal 1 [2;1;3;3;2;1] = [2;3;3;2] remove ~eq:CCInt.equal ~key:1 [2;1;3;3;2;1] = [2;3;3;2]
remove ~eq:CCInt.equal 10 [1;2;3] = [1;2;3] remove ~eq:CCInt.equal ~key:10 [1;2;3] = [1;2;3]
*) *)
let filter_map f l = let filter_map f l =
@ -1568,13 +1568,13 @@ module Assoc = struct
(*$= (*$=
[1,"1"; 2,"22"] \ [1,"1"; 2,"22"] \
(Assoc.update ~eq:CCInt.equal \ (Assoc.update ~eq:CCInt.equal \
(function Some "2" -> Some "22" | _ -> assert false) 2 [1,"1"; 2,"2"] |> lsort) ~f:(function Some "2" -> Some "22" | _ -> assert false) 2 [1,"1"; 2,"2"] |> lsort)
[1,"1"; 3,"3"] \ [1,"1"; 3,"3"] \
(Assoc.update ~eq:CCInt.equal \ (Assoc.update ~eq:CCInt.equal \
(function Some "2" -> None | _ -> assert false) 2 [1,"1"; 2,"2"; 3,"3"] |> lsort) ~f:(function Some "2" -> None | _ -> assert false) 2 [1,"1"; 2,"2"; 3,"3"] |> lsort)
[1,"1"; 2,"2"; 3,"3"] \ [1,"1"; 2,"2"; 3,"3"] \
(Assoc.update ~eq:CCInt.equal \ (Assoc.update ~eq:CCInt.equal \
(function None -> Some "3" | _ -> assert false) 3 [1,"1"; 2,"2"] |> lsort) ~f:(function None -> Some "3" | _ -> assert false) 3 [1,"1"; 2,"2"] |> lsort)
*) *)
let remove ~eq x l = let remove ~eq x l =
@ -1811,19 +1811,3 @@ let pp ?(pp_start=fun _ () -> ()) ?(pp_stop=fun _ () -> ())
~pp_stop:(fun fmt () -> Format.fprintf fmt "]") CCFormat.int)) \ ~pp_stop:(fun fmt () -> Format.fprintf fmt "]") CCFormat.int)) \
[1;2;3]) [1;2;3])
*) *)
(* test consistency of interfaces *)
(*$inject
module type L = module type of CCList
module type LL = module type of CCListLabels
*)
(*$R
ignore (module CCListLabels : L)
*)
(*$R
ignore (module CCList : LL)
*)

View file

@ -1072,18 +1072,3 @@ include Infix
"ab" < "abc" "ab" < "abc"
"123" < "14" "123" < "14"
*) *)
(* test consistency of interfaces *)
(*$inject
module type L = module type of CCString
module type LL = module type of CCStringLabels
*)
(*$R
ignore (module CCStringLabels : L)
*)
(*$R
ignore (module CCString : LL)
*)

View file

@ -0,0 +1,34 @@
module A = struct
(* test consistency of interfaces *)
module FA = CCShimsArray_.Floatarray
module type L = module type of CCArray with module Floatarray := FA
module type LL = module type of CCArrayLabels with module Floatarray := FA
let () = ignore (module CCArrayLabels : L)
let () = ignore (module CCArray : LL)
end
module S = struct
(* test consistency of interfaces *)
module type L = module type of CCString
module type LL = module type of CCStringLabels
let () = ignore (module CCStringLabels : L)
let () = ignore (module CCString : LL)
end
module L = struct
(* test consistency of interfaces *)
module type L = module type of CCList
module type LL = module type of CCListLabels
let () = ignore (module CCListLabels : L)
let () = ignore (module CCList : LL)
end
let () = print_endline "labelled modules are consistent ✔"

13
src/core/tests/dune Normal file
View file

@ -0,0 +1,13 @@
(executable
(name check_labelled_mods)
(flags :standard -warn-error -a -w -3-33-35-27-39-50 -nolabels)
(libraries containers))
; what matters is that it compiles
(alias
(name runtest)
(locks ctest)
(package containers)
(action (run ./check_labelled_mods.exe)))