Skip to content
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

Problem with constraints, with type, and polymorphic variants #7834

Closed
vicuna opened this issue Jul 31, 2018 · 4 comments
Closed

Problem with constraints, with type, and polymorphic variants #7834

vicuna opened this issue Jul 31, 2018 · 4 comments

Comments

@vicuna
Copy link

vicuna commented Jul 31, 2018

Original bug ID: 7834
Reporter: @lpw25
Status: new
Resolution: open
Priority: normal
Severity: minor
Category: typing
Monitored by: smuenzel-js @gasche

Bug description

The following code seems pretty reasonable:

  module type Q = sig
    type 'a t constraint 'a = [< `Empty | `Filled of _ ]
    module type S = sig 
      type 'a t constraint 'a = [< `Empty | `Filled of _ ] 
    end
    module M : S with type 'a t = 'a t
  end;;

but fails with the following error:

  Error: In this `with' constraint, the new definition of t
  does not match its original definition in the constrained signature:
  Type declarations do not match:                                                                                 
       type 'a t = 'a t constraint 'a = [< `Empty | `Filled of 'b & 'c & 'd ]
     is not included in
       type 'a t constraint 'a = [< `Empty | `Filled of 'b ]
     Their constraints differ.

I haven't dug into this issue properly, but I can see basically how it happens. I'm not really sure there is much we can do to fix it, I suspect it would require comparing the different &ed types, and that has been ruled out as a too much of a PITA before. Still I figured it was worth reporting anyway.

@vicuna vicuna added the typing label Mar 14, 2019
@github-actions
Copy link

github-actions bot commented May 7, 2020

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.

@github-actions github-actions bot added the Stale label May 7, 2020
@lpw25
Copy link
Contributor

lpw25 commented May 7, 2020

I think this bug should at least be looked at. @garrigue do you think this can be fixed without major surgery?

@lpw25 lpw25 removed the Stale label May 7, 2020
@garrigue
Copy link
Contributor

garrigue commented May 9, 2020

Have to think about it. Here it seems that doing some kind of garbage collection, discarding variables that appear only once, would solve the problem, but this is hardly a general solution.

In general, this amounts to solving the equivalence of two constraints, which is hard. The next version should support that...

@github-actions
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants