Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
typing difference (bug?) between 3.10.2 and 3.11(.1?)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Josh Berdine <jjb@m...>
Subject: typing difference (bug?) between 3.10.2 and 3.11(.1?)

I'm observing a difference in typing-checking of private types between 3.10.2 and 3.11.1+rc1 (I haven't checked 3.11.0).

Consider the following code:

    module M : sig
      type t = private T of int
      val mk : int -> t
    end = struct
      type t = T of int
      let mk x = T(x)

    module M' = M

    let x = M'.mk 42

    let y = M'.T(42)

With 3.10.2, the let binding for y fails to type-check:

            Objective Caml version 3.10.2
    # let y = M'.T(42);;
    Characters 8-16:
      let y = M'.T(42);;
    Cannot create values of the private type M'.t

With 3.11.1+rc1, however, it type-checks:

            Objective Caml version 3.11.1+rc1
    # let y = M'.T(42);;
    val y : M'.t = M'.T 42

Am I misunderstanding the type system, or is this not intended?

If I change the code to declare t private in the struct, or if I do not use the alias for M, type-checking fails as expected.

Cheers,  Josh