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
Printing of type aliases in signatures could be improved (with nonrec) #7458
Comments
Comment author: @garrigue This is just a fresh instance of the "unprintable signature bug", with the variant that here, there is a way to print it correctly. module type S = sig type t module M : sig type u = U of v * t and t and v = u end with type t = t end In order to print this type correctly, one would have to reorder the definitions, to remove t from its recursive group, and have it come first. This is doable, but not completely trivial. And there is the question of whether we want to do that always, or only when needed (requires some detection code), i.e. avoid to change the apparence of the signature when this is not needed. So my feeling is that it is doable (move each instantiated definition just before its recursion group, and add a nonrec keyword), but requires a bit of code to do it, and more code if we want to be conservative. |
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. |
@garrigue To me, it seems that what needs to be done here is above all
to decide whether this is going to be fixed or not. It does not seem to
be a problem to not fix this right now, but it feels it would be nice to
at least make a decision. What do you think?
Also, when you mention the "unprintable signature bug", do you refer to
a precise issue? Would you be able to link to it, if that's the case?
|
Local substitutions should make this easier. For example, @garrigue's example now has a straightforward solution: module type S = sig
type t
module M : sig
type t' := t
type u = U of v * t
and t = t'
and v = u
end
end as does my original example: module type S = sig
type t
module M : sig
type t' := t
type t = t'
end
end |
#6634 seems to be the place where the discussion is happening; so I'm closing this. |
Original bug ID: 7458
Reporter: @yallop
Assigned to: @garrigue
Status: assigned (set by @damiendoligez on 2017-02-23T16:03:12Z)
Resolution: open
Priority: normal
Severity: feature
Target version: later
Category: typing
Related to: #4791 #6634
Monitored by: @gasche @hcarty
Bug description
Type aliases declared with nonrec are printed with nonrec, as expected:
but type aliases resulting from substitution are printed incorrectly:
The text was updated successfully, but these errors were encountered: