ocaml/0009-Merge-pull-request-113...

50 lines
1.8 KiB
Diff

From 7315c73e283eca4313403e959241d86d63f88d58 Mon Sep 17 00:00:00 2001
From: Gabriel Scherer <gabriel.scherer@gmail.com>
Date: Tue, 5 Jul 2022 09:27:54 +0200
Subject: [PATCH 09/24] Merge pull request #11397 from
Octachron/tast_mapper_fix_for_with_modtype
#11387: clean up envs inside Twith_modtype(subst)
(cherry picked from commit d9afa408c612e74a266b95f0fa25bb1efde72112)
---
Changes | 3 +++
typing/tast_mapper.ml | 6 +++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Changes b/Changes
index 7ea4475b8d..0fe7732a02 100644
--- a/Changes
+++ b/Changes
@@ -18,6 +18,9 @@ OCaml 4.14 maintenance branch
This avoids a "dangling pointer" warning of GCC 12.1.
(Xavier Leroy, report by Armaël Guéneau, review by Gabriel Scherer)
+- #11387, module type with constraints no longer crash the compiler in presence
+ of both shadowing warnings and the `-bin-annot` compiler flag.
+ (Florian Angeletti, report by Christophe Raffalli, review by Gabriel Scherer)
OCaml 4.14.0 (28 March 2022)
----------------------------
diff --git a/typing/tast_mapper.ml b/typing/tast_mapper.ml
index 6d359a59a7..9eb7f64e88 100644
--- a/typing/tast_mapper.ml
+++ b/typing/tast_mapper.ml
@@ -458,10 +458,10 @@ let module_type sub x =
let with_constraint sub = function
| Twith_type decl -> Twith_type (sub.type_declaration sub decl)
| Twith_typesubst decl -> Twith_typesubst (sub.type_declaration sub decl)
+ | Twith_modtype mty -> Twith_modtype (sub.module_type sub mty)
+ | Twith_modtypesubst mty -> Twith_modtypesubst (sub.module_type sub mty)
| Twith_module _
- | Twith_modsubst _
- | Twith_modtype _
- | Twith_modtypesubst _ as d -> d
+ | Twith_modsubst _ as d -> d
let open_description sub od =
{od with open_env = sub.env sub od.open_env}
--
2.37.0.rc2