Browse thread
A bug(?) around phantoms in 3.11.0 b1 (Re: [Caml-list] OCaml version 3.11.0+beta1)
- Jun Furuse
[
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: | Jun Furuse <jun.furuse@g...> |
| Subject: | A bug(?) around phantoms in 3.11.0 b1 (Re: [Caml-list] OCaml version 3.11.0+beta1) |
Hi,
I found a strange bug in 3.11.0 beta 1. The following typical example
of phantom types does not compile any more. (It is compilable in
3.10.2, but not in release311):
module M : sig
type +'a t constraint 'a = [< `checked | `unchecked ]
val check : _ t -> [ `checked ] t
end = struct
type +'a t = { x : int } constraint 'a = [< `checked | `unchecked ]
let check (t : _ t) = t (* actually it grants anything *)
end
A strange thing is that if I change the definition as follows it compiles!
module M : sig
type +'a t constraint 'a = [< `checked | `unchecked ]
val check : _ t -> [ `checked ] t
end = struct
type u = { x : int } (* strange workaround *)
type +'a t = u constraint 'a = [< `checked | `unchecked ]
let check (t : _ t) = t (* actually it grants anything *)
end
=
j