caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Polux Moon <polux.moon@gmail.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Problem with forall and method
Date: Wed, 27 Jul 2011 07:46:09 +0900	[thread overview]
Message-ID: <955FD80F-3BD7-41C3-917F-A3FC024CD0DD@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <CANGFCiDQJPEAuWFo8MgQYQuOapUE_FMRsPCq8kR+scikeRJsBQ@mail.gmail.com>

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>



      reply	other threads:[~2011-07-26 22:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26 12:17 Polux Moon
2011-07-26 22:46 ` Jacques Garrigue [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=955FD80F-3BD7-41C3-917F-A3FC024CD0DD@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=polux.moon@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).