New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type $t is not included in type $t #6634
Comments
Comment author: @garrigue I'm not sure what the issue is.
the last t refers to int, so clearly they do not match.
Note that in the signature, t is expanded as int, but not in the type itself. |
Comment author: @yallop Sorry, yes: the problem is in the error message. |
Comment author: @garrigue pr6634.diff is a first attempt at fixing the problem, using the new "type nonrec" keyword.
A full(?) solution would put all the changed definitions at the top of the signatures, merging them in a single type nonrec. |
Note, the error is currently (
This is not ideal, but is a slight improvement. |
(I'm assuming that @yallop indeed had the "one part is implicitly nonrec and not the other" issue in mind when opening this issue, so indeed this part of the issue is not resolved: we would like to have a type-declaration printer that knows when to insert |
Another fix might be to introduce local type substitutions as needed: Type declarations do not match:
type t = [ `T of t ]
is not included in
type alias := t
type t = [ `T of alias ] |
@Octachron That's actually one of the argument that @yallop gave in his presentation on generalized includes (aka private declarations, aka I don't think anyone as come up with a complete algorithm for inserting the right aliases ... @yallop ? |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
The error message has improved again:
This said, this is a case where one would want to see that |
But the problem remains that |
We can't use type t
module type S =
sig
type s
type t = [`T of t * s]
end with type s := t Instead we should use signature-local bindings (#2122), like this: type t
module type S =
sig
type s := t
type t = [`T of t * s]
end |
If I understand correctly, the idea is that it is unclear how to add these signature-local bindings in general, but that it is a perfect fit for |
I would say that this part of the error message is wrong because some occurrences of
It would be better printed as:
|
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
For the input we are discussing type t = int
module M
: sig type t end with type t = [`T of t]
= struct type t = [`T of t] end The
and the toplevel adds, in addition,
It looks like we are getting better thanks to the ongoing error-message work, without doing anything specific for this issue. Not bad. |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
Continuing the tradition of improving the error message in this specific case indirectly, the #11515 PR ensures that the reader will be able to pick up which definition is recursive:
|
Original bug ID: 6634
Reporter: @yallop
Status: acknowledged (set by @damiendoligez on 2014-12-22T21:08:51Z)
Resolution: open
Priority: normal
Severity: feature
Target version: later
Category: typing
Tags: patch
Related to: #4791 #7458
Monitored by: @gasche @hcarty
Bug description
This may be subsumed by another report, but I thought it worth noting:
File attachments
The text was updated successfully, but these errors were encountered: