From: Khoo Yit Phang <khooyp@cs.umd.edu>
To: caml-list@yquem.inria.fr
Cc: Khoo Yit Phang <khooyp@cs.umd.edu>
Subject: Problem with class method and polymorphic variants
Date: Tue, 24 Jun 2008 14:17:36 -0400 [thread overview]
Message-ID: <9CA92F89-880D-46A8-835C-F4E93722BEE2@cs.umd.edu> (raw)
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
# ocamlc polymorphic-variants-methods-bug.ml
The implementation polymorphic-variants-methods-bug.ml
does not match the interface (inferred signature):
Type declarations do not match:
type 'a c = < d : int; s : 'a c >
constraint 'a = [< `A of < num : int; .. > & < num : int; .. > ]
is not included in
type 'a c = < d : int; s : 'a c >
constraint 'a =
[< `A of < num : int; .. > & < num : int; .. > & < num : int; ..
> ]
#ocamlc -i polymorphic-variants-methods-bug.ml
class ['a] c :
'a ->
object ('b)
constraint 'a = [< `A of < num : int; .. > ]
method d : int
method s : 'b
end
Yit
June 24, 2008
next reply other threads:[~2008-06-24 18:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 18:17 Khoo Yit Phang [this message]
2008-06-25 3:12 ` [Caml-list] " Jacques Garrigue
2008-06-25 5:17 ` Khoo Yit Phang
2008-06-26 2:46 ` Jacques Garrigue
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=9CA92F89-880D-46A8-835C-F4E93722BEE2@cs.umd.edu \
--to=khooyp@cs.umd.edu \
--cc=caml-list@yquem.inria.fr \
/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