Original bug ID: 6944 Reporter:@let-def Assigned to:@garrigue Status: closed (set by @xavierleroy on 2017-02-16T14:14:58Z) Resolution: fixed Priority: normal Severity: minor Version: 4.02.2 Fixed in version: 4.03.0+dev / +beta1 Category: typing Monitored by:@hcarty
Bug description
Let-bound modules are never typed as module aliases.
This can cause scope escape issues.
Steps to reproduce
(* Fail without module alias *)
let f () =
let module S = String in
let module N = Map.Make(S) in
N.add "sum" 41 N.empty;;
Error: This expression has type int Map.Make(S).t
but an expression was expected of type int Map.Make(S).t
The type constructor Map.Make(S).t would escape its scope
(* Succeed with *)
let f () =
let module X = struct module S = String end in
let module N = Map.Make(X.S) in
N.add "sum" 41 N.empty;;
val f : unit -> int Map.Make(String).t =
The text was updated successfully, but these errors were encountered:
Original bug ID: 6944
Reporter: @let-def
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-02-16T14:14:58Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.2
Fixed in version: 4.03.0+dev / +beta1
Category: typing
Monitored by: @hcarty
Bug description
Let-bound modules are never typed as module aliases.
This can cause scope escape issues.
Steps to reproduce
(* Fail without module alias *)
let f () =
Error: This expression has type int Map.Make(S).t
but an expression was expected of type int Map.Make(S).t
The type constructor Map.Make(S).t would escape its scope
(* Succeed with *)
let f () =
let module X = struct module S = String end in
let module N = Map.Make(X.S) in
N.add "sum" 41 N.empty;;
val f : unit -> int Map.Make(String).t =
The text was updated successfully, but these errors were encountered: