Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lpw25 committed Feb 14, 2018
1 parent 35cc6a4 commit 2b7194f
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions testsuite/tests/typing-modules/aliases.ml
Expand Up @@ -758,3 +758,65 @@ R.M.f 3;;
module rec R : sig module M = M end
- : int = 3
|}];;

module type S = sig
module M : sig
module A : sig end
module B : sig end
end
module N = M.A
end

module Foo = struct
module B = struct let x = 0 end
module A = struct let x = "hello" end
end

module Bar : S with module M := Foo = struct module N = Foo.A end

let s : string = Bar.N.x
[%%expect {|
module type S =
sig
module M : sig module A : sig end module B : sig end end
module N = M.A
end
module Foo :
sig module B : sig val x : int end module A : sig val x : string end end
module Bar : sig module N = Foo.A end
val s : string = "hello"
|}]


module M : sig
module N : sig
module A : sig val x : string end
module B : sig val x : int end
end
module F (X : sig module A = N.A end) : sig val s : string end
end = struct
module N = struct
module B = struct let x = 0 end
module A = struct let x = "hello" end
end
module F (X : sig module A : sig val x : string end end) = struct
let s = X.A.x
end
end

module N = M.F(struct module A = M.N.A end)

let s : string = N.s
[%%expect {|
module M :
sig
module N :
sig
module A : sig val x : string end
module B : sig val x : int end
end
module F : functor (X : sig module A = N.A end) -> sig val s : string end
end
module N : sig val s : string end
val s : string = "hello"
|}]

0 comments on commit 2b7194f

Please sign in to comment.