This is a bug. Please report to http://caml.inria.fr/mantis
Jacques Garrigue On 2011/07/26, at 21:17, Polux Moon wrote: > (Sorry for duplicate mail, I forgot to change the subject in the first one) > > Hi, > > I have a type error on code similar to : > > ----- > type 'par t = 'par > > let ident v = v > > class alias = > object > method alias : 'a . 'a t -> 'a = ident (* type error here *) > end > ----- > > Which gives : > > ----- > Error: This expression has type 'a. 'a t -> 'a > but an expression was expected of type 'b. 'b t -> 'b > Type 'a a = 'a is not compatible with type 'b t = 'b > ----- > > The problem is related to unification of foralls containing named type in a > method. > The compiler accepts equivalent code when not using the named type "t" or > when not using a method (see attached file). > > Is it a [known] limitation ? Is there a way to work around it ? > > <forallclass.ml> -- Caml-list mailing list. Subscription management and archives: https://sympa-roc.inria.fr/wws/info/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
