caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Numbered modules in error messages
@ 2012-06-06 10:04 Dawid Toton
  2012-06-06 16:23 ` Jacques Garrigue
  0 siblings, 1 reply; 3+ messages in thread
From: Dawid Toton @ 2012-06-06 10:04 UTC (permalink / raw)
  To: caml-list

Is it possible to make use of the numbers the compiler shows in the message below? What triggers this formatting?

Error: This expression has type O/3119.dexpr = O/3119.decor * O/3119.expr
        but an expression was expected of type
          O/1730.dexpr = O/1730.decor * O/1730.expr
        Type O/3119.decor = O/3119.decor_fst * Static.t
        is not compatible with type O/1730.decor = O/1730.decor_fst * Static.t
        Type O/3119.decor_fst = Keep_defs.P.O.decor_fst
        is not compatible with type O/1730.decor_fst = Indirloc.t

I'm asking this, because from time to time I deal with error messages like "type abc is not compatible with abc" with both abc being exactly the same strings. I'm wondering whether it is possible to force the compiler to say something more, to explain the difference between these types.

Dawid

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Numbered modules in error messages
  2012-06-06 10:04 [Caml-list] Numbered modules in error messages Dawid Toton
@ 2012-06-06 16:23 ` Jacques Garrigue
  2012-06-12 14:40   ` [Caml-list] " Dawid Toton
  0 siblings, 1 reply; 3+ messages in thread
From: Jacques Garrigue @ 2012-06-06 16:23 UTC (permalink / raw)
  To: Dawid Toton; +Cc: caml-list

On 2012/06/06, at 19:04, Dawid Toton wrote:

> Is it possible to make use of the numbers the compiler shows in the message below? What triggers this formatting?
> 
> Error: This expression has type O/3119.dexpr = O/3119.decor * O/3119.expr
>       but an expression was expected of type
>         O/1730.dexpr = O/1730.decor * O/1730.expr
>       Type O/3119.decor = O/3119.decor_fst * Static.t
>       is not compatible with type O/1730.decor = O/1730.decor_fst * Static.t
>       Type O/3119.decor_fst = Keep_defs.P.O.decor_fst
>       is not compatible with type O/1730.decor_fst = Indirloc.t
> 
> I'm asking this, because from time to time I deal with error messages like "type abc is not compatible with abc" with both abc being exactly the same strings. I'm wondering whether it is possible to force the compiler to say something more, to explain the difference between these types.

It is exactly what it does here:
it tells you that you have two versions of the module O, and that they
are incompatible because decor_fst has different definitions in these
two versions.

The output of numbers is triggered when the same identifier appears
twice for different entities.
So you should never have just "abc is not compatible with abc", as
the internal unique identifiers should be printed also.

Jacques Garrigue

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Caml-list] Re: Numbered modules in error messages
  2012-06-06 16:23 ` Jacques Garrigue
@ 2012-06-12 14:40   ` Dawid Toton
  0 siblings, 0 replies; 3+ messages in thread
From: Dawid Toton @ 2012-06-12 14:40 UTC (permalink / raw)
  To: caml-list

On 06/06/2012 06:23 PM, Jacques Garrigue wrote:
> On 2012/06/06, at 19:04, Dawid Toton wrote:
>
>>
>> I'm asking this, because from time to time I deal with error messages like "type abc is not compatible with abc" with both abc being exactly the same strings. I'm wondering whether it is possible to force the compiler to say something more, to explain the difference between these types.
>
> The output of numbers is triggered when the same identifier appears
> twice for different entities.
> So you should never have just "abc is not compatible with abc", as
> the internal unique identifiers should be printed also.
>
> Jacques Garrigue

I have checked that indeed I get these messages without the unique stamps mostly on the computer where the installed compiler is old.
Still it seems that identifiers are not always made unique, e.g. I just got the following message with 3.12.1:

Error: In this `with' constraint, the new definition of decor
        does not match its original definition in the constrained signature:
        Type declarations do not match:
          type decor = Decor.t
        is not included in
          type decor = Decor.t

In this particular case the stamps would be not useful anyway.
But in general it would be nice if the Ident.stamp values could be translated to some corresponding locations in the source code.
For example Typecore.enter_variable could feed the available loc to Ident.create?

Dawid Toton

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-12 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-06 10:04 [Caml-list] Numbered modules in error messages Dawid Toton
2012-06-06 16:23 ` Jacques Garrigue
2012-06-12 14:40   ` [Caml-list] " Dawid Toton

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).