Browse thread
typing difference (bug?) between 3.10.2 and 3.11(.1?)
- Josh Berdine
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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?) |
Hi,
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)
end
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
[snip]
# 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
[snip]
# 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