Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
(cherry picked from commit 13a56a7)
  • Loading branch information
garrigue authored and Octachron committed Nov 23, 2022
1 parent 6729eb8 commit 4d47036
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Changes
Expand Up @@ -17,6 +17,10 @@ OCaml 4.14 maintenance branch

### Bug fixes:

- #10768, #11340: Fix typechecking regression when combining first class
modules and GADTs.
(Jacques Garrigue, report by François Thiré, review by Matthew Ryan)

- #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when
calling virtual methods introduced by constraining the self type from within
the class definition.
Expand Down
11 changes: 8 additions & 3 deletions typing/typemod.ml
Expand Up @@ -2048,8 +2048,11 @@ and package_constraints env loc mty constrs =
end

let modtype_of_package env loc p fl =
package_constraints env loc (Mty_ident p)
(List.map (fun (n, t) -> (Longident.flatten n, t)) fl)
let mty =
package_constraints env loc (Mty_ident p)
(List.map (fun (n, t) -> (Longident.flatten n, t)) fl)
in
Subst.modtype Keep Subst.identity mty

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

let wrap_constraint env mark arg mty explicit =
let mark = if mark then Includemod.Mark_both else Includemod.Mark_neither in
let mty1 = Subst.modtype Keep Subst.identity arg.mod_type in
let mty2 = Subst.modtype Keep Subst.identity mty in
let coercion =
try
Includemod.modtypes ~loc:arg.mod_loc env ~mark arg.mod_type mty
Includemod.modtypes ~loc:arg.mod_loc env ~mark mty1 mty2
with Includemod.Error msg ->
raise(Error(arg.mod_loc, env, Not_included msg)) in
{ mod_desc = Tmod_constraint(arg, mty, explicit, coercion);
Expand Down

0 comments on commit 4d47036

Please sign in to comment.