Version française
Home     About     Download     Resources     Contact us    
Browse thread
Problem with class method and polymorphic variants
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Problem with class method and polymorphic variants
From: Khoo Yit Phang <khooyp@cs.umd.edu>
> Hi,
> 
> I discovered that the attached snippet of Ocaml does not compile in  
> ocamlc, but does work in the ocaml toplevel (tested in v3.10.0 and  
> 3.10.2). Removing anything (except the :int annotation) causes the  
> error to go away. Is it a bug in the type-checker?
> 
> # cat polymorphic-variants-methods-bug.ml
> class ['a] c (a : 'a) =
>     object (s)
>         method s = s
>         method d : int = match a with `A b -> b#num
>     end

Of course this is a bug. I added it myself to the bug tracker.
By the way you could also trigger it in the toplevel by giving
explicitly a module signature (this is what ocamlc does internally).

This is now fixed in CVS, branch release310.
Note that you may still have other kinds of problems using
upper-bounded polymorpic variants inside constraints. Just report them
as you go...

Cheers,

Jacques Garrigue