MantisBT - OCaml
View Issue Details
0005847OCamltypingpublic2012-12-05 14:252012-12-05 20:59
guesdon 
frisch 
normalminoralways
resolvedsuspended 
4.00.2+dev 
 
0005847: module T1 = T2 does not result in (module T1) = (module T2) as types
The following code:

module type T1 = sig end

let foo t =
  let module T = (val t : T1) in
  ()
;;

module type T2 = T1

let bar (t : (module T2)) = foo t;;

gives the following error message:

File "mtype.ml", line 11, characters 32-33:
Error: This expression has type (module T2)
       but an expression was expected of type (module T1)

I expected T2 to be equal to T1 but it doesn't seem to the case. Am I missing something ?
No tags attached.
Issue History
2012-12-05 14:25guesdonNew Issue
2012-12-05 15:04gascheSummarymodule T1 = T2 does not result in T1 = T2 => module T1 = T2 does not result in (module T1) = (module T2) as types
2012-12-05 16:39frischNote Added: 0008569
2012-12-05 16:39frischStatusnew => resolved
2012-12-05 16:39frischResolutionopen => suspended
2012-12-05 16:39frischAssigned To => frisch
2012-12-05 20:59guesdonNote Added: 0008572
2017-02-23 16:45doligezCategoryOCaml typing => typing

Notes
(0008569)
frisch   
2012-12-05 16:39   
The equality of packages types is based on the path equivalence of module types. In other words, we use nominal typing for first-class modules. This is the current expected behavior. Maybe it will be relaxed in the future, but there is no concrete plans to do so.
(0008572)
guesdon   
2012-12-05 20:59   
Ok. Sorry, I missed it in the doc (I see it now).