Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let module X = Path in … is not typed as a module alias #6944

vicuna opened this issue Jul 29, 2015 · 1 comment


None yet
2 participants
Copy link

commented Jul 29, 2015

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 =


This comment has been minimized.

Copy link

commented Sep 9, 2015

Comment author: @garrigue

Well spotted.
Fixed in trunk at revision 16412.

@vicuna vicuna closed this Feb 16, 2017

@vicuna vicuna added the typing label Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.