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

Open
vicuna opened this Issue Jul 31, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.