Skip to content

Commit 2f89dc6

Browse files
committed
modal modules
1 parent c3026db commit 2f89dc6

Some content is hidden

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

52 files changed

+1614
-863
lines changed

chamelon/chamelon.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ let minimizers_to_run =
121121
(* ______ ONE FILE MINIMIZATION ______ *)
122122

123123
(** [one_file_minimize c map file] minimizes [file] in the file set [map]
124-
regarding to the command [c] *)
124+
regarding to the command [c] *)
125125
let one_file_minimize c (map : structure Smap.t) file : structure Smap.t * bool
126126
=
127127
if !test then (

chamelon/compat.mli

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ type texp_function_param = {
1919
param : Ident.t;
2020
partial : partial;
2121
optional_default : expression option;
22-
(** The optional argument's default value. If [optional_default] is present,
23-
[arg_label] must be [Optional], and [pattern] matches values of type [t]
24-
if the parameter type is [t option]. *)
22+
(** The optional argument's default value. If [optional_default] is
23+
present, [arg_label] must be [Optional], and [pattern] matches values
24+
of type [t] if the parameter type is [t option]. *)
2525
param_identifier : texp_function_param_identifier;
2626
}
2727

chamelon/function_compat.mli

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
open Typedtree
44
open Compat
55

6-
(** [cases_view] is similar to an old version of the [texp_function] type.
7-
It would take some work to update old clients to use the new [texp_function]
8-
type, so instead we have this compatibility layer between [cases_view] and
9-
the new version of [texp_function].
6+
(** [cases_view] is similar to an old version of the [texp_function] type. It
7+
would take some work to update old clients to use the new [texp_function]
8+
type, so instead we have this compatibility layer between [cases_view] and
9+
the new version of [texp_function].
1010
1111
(Though, at some point we should just update the clients and remove this
12-
compatibility layer.)
13-
*)
12+
compatibility layer.) *)
1413

1514
type cases_view_identifier =
1615
| Cases of texp_function_cases_identifier

chamelon/iterator.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ let step_minimizer c minimize cur_file map ~pos ~len =
6969
in
7070
r
7171

72-
(** [apply_minimizer test map cur_file minimize c] applies [minimize] for [cur_file]
73-
in the file set [mapi] for the command [c] as much as possible if (not !test),
74-
only once otherwise *)
72+
(** [apply_minimizer test map cur_file minimize c] applies [minimize] for
73+
[cur_file] in the file set [mapi] for the command [c] as much as possible if
74+
(not !test), only once otherwise *)
7575
let dicho = true
7676

7777
let apply_minimizer test map cur_file minimize (c : string) =

chamelon/minimizer/simplifymatch.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ open Tast_mapper
66
open Compat
77

88
(** [replace_mapper id to_replace] is a mapper replacing every occurence of [id]
9-
by the expression [to_replace]*)
9+
by the expression [to_replace]*)
1010
let replace_mapper id to_replace =
1111
{
1212
Tast_mapper.default with

chamelon/utils.ml

+8-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ let rec path_eq p1 p2 =
4141
| Papply (t11, t12), Papply (t21, t22) -> path_eq t11 t21 && path_eq t12 t22
4242
| _ -> false
4343

44-
(** [replace_path path n_path] is a mapper replacing each occurence of the path [path] by [n_path]*)
44+
(** [replace_path path n_path] is a mapper replacing each occurence of the path
45+
[path] by [n_path]*)
4546
let replace_path path n_path =
4647
{
4748
Tast_mapper.default with
@@ -86,7 +87,8 @@ let replace_path path n_path =
8687
| _ -> Tast_mapper.default.typ mapper ct);
8788
}
8889

89-
(** [replace_id id n_id] is a mapper replacing each occurence of the ident [id] by [n_id]*)
90+
(** [replace_id id n_id] is a mapper replacing each occurence of the ident [id]
91+
by [n_id]*)
9092
let replace_id id n_id =
9193
{
9294
Tast_mapper.default with
@@ -182,15 +184,16 @@ let update_single name str =
182184
flush oc;
183185
close_out oc
184186

185-
(** [add_def str] adds dummy1, dummy2 and ignore definitions, needed by some minmizers, in [str]*)
187+
(** [add_def str] adds dummy1, dummy2 and ignore definitions, needed by some
188+
minmizers, in [str]*)
186189
let add_def str =
187190
{
188191
str with
189192
str_items = dummy1_def :: dummy2_def :: ignore_def :: str.str_items;
190193
}
191194

192-
(** [update_output map] replaces the content of each file
193-
by its associated structure in [map] *)
195+
(** [update_output map] replaces the content of each file by its associated
196+
structure in [map] *)
194197
let update_output map = Smap.iter update_single (Smap.map add_def map)
195198

196199
let save_outputs map =

driver/compile_common.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ let typecheck_intf info ast =
8686
(Printtyp.printed_signature (Unit_info.source_file info.target))
8787
sg);
8888
ignore (Includemod.signatures info.env ~mark:Mark_both
89-
~modes:(Legacy None) sg sg);
89+
~modes:Includemod.modes_unit sg sg);
9090
Typecore.force_delayed_checks ();
9191
Builtin_attributes.warn_unused ();
9292
Warnings.check_fatal ();

otherlibs/stdlib_alpha/effect.mli

-5
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ module type S = sig
123123
with [t] to tie the knot on recursive operations. *)
124124

125125
module Result : sig
126-
@@ portable
127126

128127
type eff := t
129128

@@ -274,8 +273,6 @@ module type S1 = sig
274273
with ['p t] to tie the knot on recursive operations. *)
275274

276275
module Result : sig
277-
@@ portable
278-
279276
type 'p eff := 'p t
280277

281278
type ('a, 'p, 'es) t =
@@ -418,8 +415,6 @@ module type S2 = sig
418415
with [('p, 'q) t] to tie the knot on recursive operations. *)
419416

420417
module Result : sig
421-
@@ portable
422-
423418
type ('p, 'q) eff := ('p, 'q) t
424419

425420
type ('a, 'p, 'q, 'es) t =

parsing/builtin_attributes.ml

-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ let builtin_attrs =
115115
; "layout_poly"
116116
; "no_mutable_implied_modalities"
117117
; "or_null_reexport"
118-
; "no_recursive_modalities"
119118
; "jane.non_erasable.instances"
120119
]
121120

stdlib/ephemeron.mli

+15-15
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ end
150150
(** The output signature of the functors {!K1.MakeSeeded} and {!K2.MakeSeeded}.
151151
*)
152152

153-
module K1 : sig
153+
module K1 : sig @@ portable
154154
type ('k,'d) t (** an ephemeron with one key *)
155155

156156
val make : 'k -> 'd -> ('k,'d) t
@@ -161,19 +161,19 @@ module K1 : sig
161161
ephemeron's data) if [key] is physically equal to [eph]'s key, and
162162
[None] if [eph] is empty or [key] is not equal to [eph]'s key. *)
163163

164-
module Make (H:Hashtbl.HashedType) : S with type key = H.t
164+
module (Make @ nonportable) (H:Hashtbl.HashedType) : S with type key = H.t
165165
(** Functor building an implementation of a weak hash table *)
166166

167167
module MakePortable (H:sig @@ portable include Hashtbl.HashedType end)
168168
: sig @@ portable include S with type key = H.t end
169169
(** Like {!Make}, but takes a portable [hash] function to
170170
portable [Ephemeron] operations. *)
171171

172-
module MakeSeeded (H:Hashtbl.SeededHashedType) : SeededS with type key = H.t
172+
module (MakeSeeded @ nonportable) (H:Hashtbl.SeededHashedType) : SeededS with type key = H.t
173173
(** Functor building an implementation of a weak hash table.
174174
The seed is similar to the one of {!Hashtbl.MakeSeeded}. *)
175175

176-
module MakeSeededPortable (H:sig @@ portable include Hashtbl.SeededHashedType end)
176+
module (MakeSeededPortable @ nonportable) (H:sig @@ portable include Hashtbl.SeededHashedType end)
177177
: sig @@ portable include SeededS with type key = H.t end
178178
(** Like {!MakeSeeded}, but takes a portable [seeded_hash] function to
179179
portable [Ephemeron] operations. *)
@@ -206,10 +206,10 @@ module K1 : sig
206206

207207
end
208208

209-
end
209+
end @@ nonportable
210210
(** Ephemerons with one key. *)
211211

212-
module K2 : sig
212+
module K2 : sig @@ portable
213213
type ('k1,'k2,'d) t (** an ephemeron with two keys *)
214214

215215
val make : 'k1 -> 'k2 -> 'd -> ('k1,'k2,'d) t
@@ -218,7 +218,7 @@ module K2 : sig
218218
val query : ('k1,'k2,'d) t -> 'k1 -> 'k2 -> 'd option
219219
(** Same as {!Ephemeron.K1.query} *)
220220

221-
module Make
221+
module (Make @ nonportable)
222222
(H1:Hashtbl.HashedType)
223223
(H2:Hashtbl.HashedType) :
224224
S with type key = H1.t * H2.t
@@ -231,14 +231,14 @@ module K2 : sig
231231
(** Like {!Make}, but takes portable [hash] functions to
232232
portable [Ephemeron] operations. *)
233233

234-
module MakeSeeded
234+
module (MakeSeeded @ nonportable)
235235
(H1:Hashtbl.SeededHashedType)
236236
(H2:Hashtbl.SeededHashedType) :
237237
SeededS with type key = H1.t * H2.t
238238
(** Functor building an implementation of a weak hash table.
239239
The seed is similar to the one of {!Hashtbl.MakeSeeded}. *)
240240

241-
module MakeSeededPortable
241+
module (MakeSeededPortable @ nonportable)
242242
(H1:sig @@ portable include Hashtbl.SeededHashedType end)
243243
(H2:sig @@ portable include Hashtbl.SeededHashedType end) :
244244
sig @@ portable include SeededS with type key = H1.t * H2.t end
@@ -273,10 +273,10 @@ module K2 : sig
273273

274274
end
275275

276-
end
276+
end @@ nonportable
277277
(** Ephemerons with two keys. *)
278278

279-
module Kn : sig
279+
module Kn : sig @@ portable
280280
type ('k,'d) t (** an ephemeron with an arbitrary number of keys
281281
of the same type *)
282282

@@ -286,7 +286,7 @@ module Kn : sig
286286
val query : ('k,'d) t -> 'k array -> 'd option
287287
(** Same as {!Ephemeron.K1.query} *)
288288

289-
module Make
289+
module (Make @ nonportable)
290290
(H:Hashtbl.HashedType) :
291291
S with type key = H.t array
292292
(** Functor building an implementation of a weak hash table *)
@@ -297,13 +297,13 @@ module Kn : sig
297297
(** Like {!Make}, but takes a portable [hash] function to
298298
portable [Ephemeron] operations. *)
299299

300-
module MakeSeeded
300+
module (MakeSeeded @ nonportable)
301301
(H:Hashtbl.SeededHashedType) :
302302
SeededS with type key = H.t array
303303
(** Functor building an implementation of a weak hash table.
304304
The seed is similar to the one of {!Hashtbl.MakeSeeded}. *)
305305

306-
module MakeSeededPortable
306+
module (MakeSeededPortable @ nonportable)
307307
(H:sig @@ portable include Hashtbl.SeededHashedType end) :
308308
sig @@ portable include SeededS with type key = H.t array end
309309
(** Like {!MakeSeeded}, but takes a portable [seeded_hash] function to
@@ -337,5 +337,5 @@ module Kn : sig
337337

338338
end
339339

340-
end
340+
end @@ nonportable
341341
(** Ephemerons with arbitrary number of keys of the same type. *)

stdlib/hashtbl.mli

+2-2
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ module type S =
421421
end
422422
(** The output signature of the functor {!Make}. *)
423423

424-
module Make (H : HashedType) : S with type key = H.t
424+
module (Make @ nonportable) (H : HashedType) : S with type key = H.t
425425
(** Functor building an implementation of the hashtable structure.
426426
The functor [Hashtbl.Make] returns a structure containing
427427
a type [key] of keys and a type ['a t] of hash tables
@@ -504,7 +504,7 @@ module type SeededS =
504504
(** The output signature of the functor {!MakeSeeded}.
505505
@since 4.00 *)
506506

507-
module MakeSeeded (H : SeededHashedType) : SeededS with type key = H.t
507+
module (MakeSeeded @ nonportable) (H : SeededHashedType) : SeededS with type key = H.t
508508
(** Functor building an implementation of the hashtable structure.
509509
The functor [Hashtbl.MakeSeeded] returns a structure containing
510510
a type [key] of keys and a type ['a t] of hash tables

stdlib/moreLabels.mli

+6-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ open! Stdlib
3939

4040
[@@@ocaml.nolabels]
4141

42-
module Hashtbl : sig
42+
module Hashtbl : sig @@ portable
4343
(** Hash tables and hash functions.
4444
4545
Hash tables are hashed association tables, with in-place modification.
@@ -440,7 +440,7 @@ module Hashtbl : sig
440440
end
441441
(** The output signature of the functor {!Make}. *)
442442

443-
module Make : functor (H : HashedType) -> S
443+
module (Make @ nonportable) : functor (H : HashedType) -> S
444444
with type key = H.t
445445
and type 'a t = 'a Hashtbl.Make(H).t
446446
(** Functor building an implementation of the hashtable structure.
@@ -528,7 +528,7 @@ module Hashtbl : sig
528528
(** The output signature of the functor {!MakeSeeded}.
529529
@since 4.00 *)
530530

531-
module MakeSeeded (H : SeededHashedType) : SeededS
531+
module (MakeSeeded @ nonportable) (H : SeededHashedType) : SeededS
532532
with type key = H.t
533533
and type 'a t = 'a Hashtbl.MakeSeeded(H).t
534534
(** Functor building an implementation of the hashtable structure.
@@ -685,7 +685,7 @@ module Hashtbl : sig
685685
686686
*)
687687

688-
end
688+
end @@ nonportable
689689

690690
module Map : sig
691691
(** Association tables over ordered types.
@@ -1049,7 +1049,7 @@ module Map : sig
10491049
(** Like {!Make}, but takes a portable [compare] function to
10501050
portable [Map] operations. *)
10511051

1052-
end
1052+
end @@ nonportable
10531053

10541054
module Set : sig
10551055
(** Sets over ordered types.
@@ -1368,4 +1368,4 @@ module Set : sig
13681368
(** Like {!Make}, but takes a portable [compare] function to
13691369
portable [Set] operations. *)
13701370

1371-
end
1371+
end @@ nonportable

stdlib/stdLabels.mli

+2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ open! Stdlib
3737

3838
[@@@ocaml.nolabels]
3939

40+
include sig
4041
module Array = ArrayLabels
4142
module Bytes = BytesLabels
4243
module List = ListLabels
4344
module String = StringLabels
45+
end @@ nonportable

stdlib/stdlib.mli

+2
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,7 @@ val do_domain_local_at_exit : (unit -> unit) ref @@ nonportable
14121412
(** {1:modules Standard library modules } *)
14131413

14141414
(*MODULE_ALIASES*)
1415+
include sig
14151416
module Arg = Arg
14161417
module Array = Array
14171418
module ArrayLabels = ArrayLabels
@@ -1482,3 +1483,4 @@ module Type = Type
14821483
module Uchar = Uchar
14831484
module Unit = Unit
14841485
module Weak = Weak
1486+
end @@ nonportable

stdlib/sys.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ module Immediate64 : sig
491491
| Non_immediate : Non_immediate.t repr
492492
val repr : t repr
493493
end
494-
end
494+
end @@ nonportable
495495

496496
(** Submodule containing non-backwards-compatible functions which enforce thread safety
497497
via modes. *)

stdlib/weak.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ module type S = sig
198198
end
199199
(** The output signature of the functor {!Weak.Make}. *)
200200

201-
module Make (H : Hashtbl.HashedType) : S with type data = H.t
201+
module (Make @ nonportable) (H : Hashtbl.HashedType) : S with type data = H.t
202202
(** Functor building an implementation of the weak hash set structure.
203203
[H.equal] can't be the physical equality, since only shallow
204204
copies of the elements in the set are given to it.

testsuite/tests/formatting/test_locations.dlocations.ocamlc.reference

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ let rec fib = function | 0 | 1 -> 1 | n -> (fib (n - 1)) + (fib (n - 2))
8989
<def_rec>
9090
pattern (test_locations.ml[17,534+8]..test_locations.ml[17,534+11])
9191
Tpat_var "fib"
92-
value_mode global,many,portable,unyielding;imply(unique,uncontended)(modevar#1[aliased,contended .. unique,uncontended])
92+
value_mode global,many,portable,unyielding;imply(unique,uncontended)(modevar#3[aliased,contended .. unique,uncontended])
9393
expression (test_locations.ml[17,534+14]..test_locations.ml[19,572+34])
9494
Texp_function
95-
alloc_mode global,many,portable,unyielding;id(modevar#7[aliased,contended .. unique,uncontended])
95+
alloc_mode global,many,portable,unyielding;id(modevar#9[aliased,contended .. unique,uncontended])
9696
[]
9797
Tfunction_cases (test_locations.ml[17,534+14]..test_locations.ml[19,572+34])
9898
alloc_mode global,many,nonportable,unyielding;aliased,uncontended

testsuite/tests/formatting/test_locations.dno-locations.ocamlc.reference

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ let rec fib = function | 0 | 1 -> 1 | n -> (fib (n - 1)) + (fib (n - 2))
8989
<def_rec>
9090
pattern
9191
Tpat_var "fib"
92-
value_mode global,many,portable,unyielding;imply(unique,uncontended)(modevar#1[aliased,contended .. unique,uncontended])
92+
value_mode global,many,portable,unyielding;imply(unique,uncontended)(modevar#3[aliased,contended .. unique,uncontended])
9393
expression
9494
Texp_function
95-
alloc_mode global,many,portable,unyielding;id(modevar#7[aliased,contended .. unique,uncontended])
95+
alloc_mode global,many,portable,unyielding;id(modevar#9[aliased,contended .. unique,uncontended])
9696
[]
9797
Tfunction_cases
9898
alloc_mode global,many,nonportable,unyielding;aliased,uncontended

0 commit comments

Comments
 (0)