Skip to content

Commit

Permalink
promote val_modalities to stable
Browse files Browse the repository at this point in the history
  • Loading branch information
riaqn committed Dec 18, 2024
1 parent 8d31575 commit 5b83bab
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion testsuite/tests/typing-modes/incl_modalities.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* TEST
flags += "-extension mode_alpha";
flags += "-extension mode";
expect;
*)

Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/typing-modes/md_modalities.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* TEST
flags += "-extension mode_alpha";
flags += "-extension mode";
expect;
*)

Expand Down
12 changes: 0 additions & 12 deletions testsuite/tests/typing-modes/modes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -366,18 +366,6 @@ let foo () =
val foo : unit -> unit = <fun>
|}]

(* modalities on normal values requires [-extension mode_alpha] *)
module type S = sig
val x : string -> string @ local @@ foo bar
end
[%%expect{|
Line 2, characters 38-41:
2 | val x : string -> string @ local @@ foo bar
^^^
Error: The extension "mode" is disabled and cannot be used
|}]


(*
* Modification of return modes in argument position
*)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/typing-modes/portable_interface.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
readonly_files = "portable_interface.mli use_portable_interface.ml";
flags += "-extension mode_alpha";
flags += "-extension mode";
setup-ocamlc.byte-build-env;
module = "portable_interface.mli";
ocamlc.byte;
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/typing-modes/val_modalities.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* TEST
flags = "-extension mode_alpha";
flags = "-extension mode";
expect;
*)

Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/typing-modes/val_modalities_floor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ strongest instead of legacy *)
";
{
setup-ocamlopt.byte-build-env;
flags = "-extension mode_alpha";
flags = "-extension mode";
{
src = "def_portable.ml";
Expand Down
2 changes: 1 addition & 1 deletion typing/typedecl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3052,7 +3052,7 @@ let transl_value_decl env loc ~sig_modalities valdecl =
let modalities =
match valdecl.pval_modalities with
| [] -> sig_modalities
| l -> Typemode.transl_modalities ~maturity:Alpha Immutable
| l -> Typemode.transl_modalities ~maturity:Stable Immutable
valdecl.pval_attributes l
in
let modalities = Mode.Modality.Value.of_const modalities in
Expand Down
10 changes: 5 additions & 5 deletions typing/typemod.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ let apply_pmd_modalities env sig_modalities pmd_modalities mty =
match pmd_modalities with
| [] -> sig_modalities
| _ :: _ ->
Typemode.transl_modalities ~maturity:Alpha Immutable [] pmd_modalities
Typemode.transl_modalities ~maturity:Stable Immutable [] pmd_modalities
in
(*
Workaround for pmd_modalities
Expand Down Expand Up @@ -1248,7 +1248,7 @@ and approx_sig_items env ssg=
| [] -> sg
| _ ->
let modalities =
Typemode.transl_modalities ~maturity:Alpha Immutable [] moda
Typemode.transl_modalities ~maturity:Stable Immutable [] moda
in
let recursive =
not @@ Builtin_attributes.has_attribute "no_recursive_modalities" attrs
Expand Down Expand Up @@ -1750,7 +1750,7 @@ and transl_signature env {psg_items; psg_modalities; psg_loc} =
let names = Signature_names.create () in

let sig_modalities =
Typemode.transl_modalities ~maturity:Alpha Immutable [] psg_modalities
Typemode.transl_modalities ~maturity:Stable Immutable [] psg_modalities
in

let transl_include ~loc env sig_acc sincl modalities =
Expand All @@ -1776,7 +1776,7 @@ and transl_signature env {psg_items; psg_modalities; psg_loc} =
match modalities with
| [] -> sig_modalities
| _ ->
Typemode.transl_modalities ~maturity:Alpha Immutable [] modalities
Typemode.transl_modalities ~maturity:Stable Immutable [] modalities
in
let sg =
if not @@ Mode.Modality.Value.Const.is_id modalities then
Expand Down Expand Up @@ -2561,7 +2561,7 @@ let simplify_app_summary app_view = match app_view.arg with
| false, None -> Includemod.Error.Anonymous, mty

let maybe_infer_modalities ~loc ~env ~md_mode ~mode =
if Language_extension.(is_at_least Mode Alpha) then begin
if Language_extension.(is_at_least Mode Stable) then begin
(* Upon construction, for comonadic (prescriptive) axes, module
must be weaker than the values therein, for otherwise operations
would be allowed to performed on the module (and extended to the
Expand Down

0 comments on commit 5b83bab

Please sign in to comment.