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

Closed
vicuna opened this issue Jul 29, 2015 · 1 comment
Closed

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

vicuna opened this issue Jul 29, 2015 · 1 comment
Assignees

Comments

@vicuna
Copy link

vicuna 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 =

@vicuna
Copy link
Author

vicuna commented Sep 9, 2015

Comment author: @garrigue

Well spotted.
Fixed in trunk at revision 16412.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants