Skip to content

Commit 077fea5

Browse files
committed
modal modules
1 parent 69d23ea commit 077fea5

Some content is hidden

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

42 files changed

+1077
-781
lines changed

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 ();

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)