From 53d6bd38aaece427e75555921612a7130b510c57 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Thu, 24 Aug 2023 09:03:12 -0400 Subject: [PATCH 1/2] Regulate access to [Language_extension] from within Jane Syntax --- ocaml/parsing/jane_syntax.ml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ocaml/parsing/jane_syntax.ml b/ocaml/parsing/jane_syntax.ml index d99310fc7a6..36af3370f55 100644 --- a/ocaml/parsing/jane_syntax.ml +++ b/ocaml/parsing/jane_syntax.ml @@ -2,6 +2,19 @@ open Asttypes open Parsetree open Jane_syntax_parsing +(** We carefully regulate which bindings we import from [Language_extension] + to ensure that we can import this file into the Jane Street internal + repo with no changes. +*) +module Language_extension = struct + include Language_extension_kernel + include ( + Language_extension + : Language_extension_kernel.Language_extension_for_jane_syntax) +end + +module _ = Language_extension + (****************************************) (* Helpers used just within this module *) @@ -767,14 +780,15 @@ module N_ary_functions = struct List.iter (fun mode_annotation -> assert_extension_enabled ~loc (match (mode_annotation.txt : mode_annotation) with - | Local -> Language_extension.Local - | Unique | Once -> Language_extension.Unique) + | Local -> Local + | Unique | Once -> Unique) ()) mode_annotations; Mode_constraint mode_annotations) | [ "layout_annotation" ] -> Payload (fun payload ~loc -> - assert_extension_enabled ~loc Layouts Language_extension.Stable; + assert_extension_enabled ~loc Layouts + (Stable : Language_extension.maturity); let layout_annotation = Layout_annotation.Decode.from_payload payload ~loc in From 1efb6dda07f334a817ff4b686396c6761e9ac8f9 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Thu, 24 Aug 2023 14:12:14 -0400 Subject: [PATCH 2/2] Update ocaml/parsing/jane_syntax.ml --- ocaml/parsing/jane_syntax.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ocaml/parsing/jane_syntax.ml b/ocaml/parsing/jane_syntax.ml index 36af3370f55..10ab317f20e 100644 --- a/ocaml/parsing/jane_syntax.ml +++ b/ocaml/parsing/jane_syntax.ml @@ -13,6 +13,8 @@ module Language_extension = struct : Language_extension_kernel.Language_extension_for_jane_syntax) end +(* Suppress the unused module warning so it's easy to keep around the + shadowing even if we delete use sites of the module. *) module _ = Language_extension (****************************************)