Skip to content

Support modules of non-legacy modes #3759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: minor-fix-modes
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion driver/compile_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ let typecheck_intf info ast =
(Printtyp.printed_signature (Unit_info.source_file info.target))
sg);
ignore (Includemod.signatures info.env ~mark:Mark_both
~modes:(Legacy None) sg sg);
~modes:Includemod.modes_unit sg sg);
Typecore.force_delayed_checks ();
Builtin_attributes.warn_unused ();
Warnings.check_fatal ();
Expand Down
5 changes: 0 additions & 5 deletions otherlibs/stdlib_alpha/effect.mli
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ module type S = sig
with [t] to tie the knot on recursive operations. *)

module Result : sig
@@ portable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems strange for this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed, since there is @@ portable at the begining of this file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I don't care enough to put my foot down here, but I think we should avoid this kind of unrelated cleanup on otherwise unaffected files.


type eff := t

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

module Result : sig
@@ portable

type 'p eff := 'p t

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

module Result : sig
@@ portable

type ('p, 'q) eff := ('p, 'q) t

type ('a, 'p, 'q, 'es) t =
Expand Down
1 change: 0 additions & 1 deletion parsing/builtin_attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ let builtin_attrs =
; "layout_poly"
; "no_mutable_implied_modalities"
; "or_null_reexport"
; "no_recursive_modalities"
; "jane.non_erasable.instances"
]

Expand Down
30 changes: 15 additions & 15 deletions stdlib/ephemeron.mli
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ end
(** The output signature of the functors {!K1.MakeSeeded} and {!K2.MakeSeeded}.
*)

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

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

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

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

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

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

end

end
end @@ nonportable
(** Ephemerons with one key. *)

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

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

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

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

module MakeSeededPortable
module (MakeSeededPortable @ nonportable)
(H1:sig @@ portable include Hashtbl.SeededHashedType end)
(H2:sig @@ portable include Hashtbl.SeededHashedType end) :
sig @@ portable include SeededS with type key = H1.t * H2.t end
Expand Down Expand Up @@ -273,10 +273,10 @@ module K2 : sig

end

end
end @@ nonportable
(** Ephemerons with two keys. *)

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

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

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

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

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

end

end
end @@ nonportable
(** Ephemerons with arbitrary number of keys of the same type. *)
4 changes: 2 additions & 2 deletions stdlib/hashtbl.mli
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ module type S =
end
(** The output signature of the functor {!Make}. *)

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

module MakeSeeded (H : SeededHashedType) : SeededS with type key = H.t
module (MakeSeeded @ nonportable) (H : SeededHashedType) : SeededS with type key = H.t
(** Functor building an implementation of the hashtable structure.
The functor [Hashtbl.MakeSeeded] returns a structure containing
a type [key] of keys and a type ['a t] of hash tables
Expand Down
10 changes: 5 additions & 5 deletions stdlib/moreLabels.mli
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ open! Stdlib

[@@@ocaml.nolabels]

module Hashtbl : sig
module (Hashtbl @ nonportable) : sig @@ portable
(** Hash tables and hash functions.

Hash tables are hashed association tables, with in-place modification.
Expand Down Expand Up @@ -440,7 +440,7 @@ module Hashtbl : sig
end
(** The output signature of the functor {!Make}. *)

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

module MakeSeeded (H : SeededHashedType) : SeededS
module (MakeSeeded @ nonportable) (H : SeededHashedType) : SeededS
with type key = H.t
and type 'a t = 'a Hashtbl.MakeSeeded(H).t
(** Functor building an implementation of the hashtable structure.
Expand Down Expand Up @@ -687,7 +687,7 @@ module Hashtbl : sig

end

module Map : sig
module (Map @ nonportable) : sig
(** Association tables over ordered types.

This module implements applicative association tables, also known as
Expand Down Expand Up @@ -1051,7 +1051,7 @@ module Map : sig

end

module Set : sig
module (Set @ nonportable) : sig
(** Sets over ordered types.

This module implements the set data structure, given a total ordering
Expand Down
2 changes: 2 additions & 0 deletions stdlib/stdLabels.mli
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ open! Stdlib

[@@@ocaml.nolabels]

include sig
module Array = ArrayLabels
module Bytes = BytesLabels
module List = ListLabels
module String = StringLabels
end @@ nonportable
2 changes: 2 additions & 0 deletions stdlib/stdlib.mli
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,7 @@ val do_domain_local_at_exit : (unit -> unit) ref @@ nonportable
(** {1:modules Standard library modules } *)

(*MODULE_ALIASES*)
include sig
module Arg = Arg
module Array = Array
module ArrayLabels = ArrayLabels
Expand Down Expand Up @@ -1482,3 +1483,4 @@ module Type = Type
module Uchar = Uchar
module Unit = Unit
module Weak = Weak
end @@ nonportable
2 changes: 1 addition & 1 deletion stdlib/sys.mli
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ external[@layout_poly] opaque_identity : ('a : any). 'a -> 'a = "%opaque"
@since 4.03
*)

module Immediate64 : sig
module (Immediate64 @ nonportable) : sig
(** This module allows to define a type [t] with the [immediate64]
attribute. This attribute means that the type is immediate on 64
bit architectures. On other architectures, it might or might not
Expand Down
2 changes: 1 addition & 1 deletion stdlib/weak.mli
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module type S = sig
end
(** The output signature of the functor {!Weak.Make}. *)

module Make (H : Hashtbl.HashedType) : S with type data = H.t
module (Make @ nonportable) (H : Hashtbl.HashedType) : S with type data = H.t
(** Functor building an implementation of the weak hash set structure.
[H.equal] can't be the physical equality, since only shallow
copies of the elements in the set are given to it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ let rec fib = function | 0 | 1 -> 1 | n -> (fib (n - 1)) + (fib (n - 2))
<def_rec>
pattern (test_locations.ml[17,534+8]..test_locations.ml[17,534+11])
Tpat_var "fib"
value_mode global,many,portable,unyielding;imply(unique,uncontended)(modevar#1[aliased,contended .. unique,uncontended])
value_mode global,many,portable,unyielding;imply(unique,uncontended)(modevar#3[aliased,contended .. unique,uncontended])
expression (test_locations.ml[17,534+14]..test_locations.ml[19,572+34])
Texp_function
alloc_mode global,many,portable,unyielding;id(modevar#7[aliased,contended .. unique,uncontended])
alloc_mode global,many,portable,unyielding;id(modevar#9[aliased,contended .. unique,uncontended])
[]
Tfunction_cases (test_locations.ml[17,534+14]..test_locations.ml[19,572+34])
alloc_mode global,many,nonportable,unyielding;aliased,uncontended
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ let rec fib = function | 0 | 1 -> 1 | n -> (fib (n - 1)) + (fib (n - 2))
<def_rec>
pattern
Tpat_var "fib"
value_mode global,many,portable,unyielding;imply(unique,uncontended)(modevar#1[aliased,contended .. unique,uncontended])
value_mode global,many,portable,unyielding;imply(unique,uncontended)(modevar#3[aliased,contended .. unique,uncontended])
expression
Texp_function
alloc_mode global,many,portable,unyielding;id(modevar#7[aliased,contended .. unique,uncontended])
alloc_mode global,many,portable,unyielding;id(modevar#9[aliased,contended .. unique,uncontended])
[]
Tfunction_cases
alloc_mode global,many,nonportable,unyielding;aliased,uncontended
Expand Down
Loading