Skip to content

Commit 4d47036

Browse files
garrigueOctachron
authored andcommitted
(cherry picked from commit 13a56a7)
1 parent 6729eb8 commit 4d47036

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Changes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ OCaml 4.14 maintenance branch
1717

1818
### Bug fixes:
1919

20+
- #10768, #11340: Fix typechecking regression when combining first class
21+
modules and GADTs.
22+
(Jacques Garrigue, report by François Thiré, review by Matthew Ryan)
23+
2024
- #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when
2125
calling virtual methods introduced by constraining the self type from within
2226
the class definition.

typing/typemod.ml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,8 +2048,11 @@ and package_constraints env loc mty constrs =
20482048
end
20492049

20502050
let modtype_of_package env loc p fl =
2051-
package_constraints env loc (Mty_ident p)
2052-
(List.map (fun (n, t) -> (Longident.flatten n, t)) fl)
2051+
let mty =
2052+
package_constraints env loc (Mty_ident p)
2053+
(List.map (fun (n, t) -> (Longident.flatten n, t)) fl)
2054+
in
2055+
Subst.modtype Keep Subst.identity mty
20532056

20542057
let package_subtype env p1 fl1 p2 fl2 =
20552058
let mkmty p fl =
@@ -2069,9 +2072,11 @@ let () = Ctype.package_subtype := package_subtype
20692072

20702073
let wrap_constraint env mark arg mty explicit =
20712074
let mark = if mark then Includemod.Mark_both else Includemod.Mark_neither in
2075+
let mty1 = Subst.modtype Keep Subst.identity arg.mod_type in
2076+
let mty2 = Subst.modtype Keep Subst.identity mty in
20722077
let coercion =
20732078
try
2074-
Includemod.modtypes ~loc:arg.mod_loc env ~mark arg.mod_type mty
2079+
Includemod.modtypes ~loc:arg.mod_loc env ~mark mty1 mty2
20752080
with Includemod.Error msg ->
20762081
raise(Error(arg.mod_loc, env, Not_included msg)) in
20772082
{ mod_desc = Tmod_constraint(arg, mty, explicit, coercion);

0 commit comments

Comments
 (0)