English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Oddness concerning private variants in 3.10.0
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-09-07 (21:04)
From: Chris King <colanderman@g...>
Subject: Oddness concerning private variants in 3.10.0

I just took the leap to 3.10 and encountered some strangeness
compiling my project with it:

The implementation input_test.ml
does not match the interface (inferred signature):
Type declarations do not match:
  type button = FrGui.button
is not included in
  type button = FrGui.button#row

First, I don't understand how a module doesn't match its inferred
signature.  Strangely, creating a blank input_test.mli file gets
around this error.

Second, the type button (which is a private variant) isn't even
defined in input_test.ml, it's defined in a module opened by it.

I tried coming up with some minimal test cases and found even more
interesting results:

Compiling this:

module A: sig
  type t = [ `A | `B ]
end = struct
  type t = private [> `A ]

results in the error:

Type declarations do not match:
  type t = private [> `A ]
is not included in
  type t = [ `A | `B ]

But compiling this:

type t = [ `A | `B ]

with this .mli file:

type t = private [> `A ]

works fine.  What is going on here?

I haven't yet been able to reproduce the error in my project using a
minimal test case but I will post it when I do.