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

Bug in type-checker with GADTs and inline records #7372

Closed
vicuna opened this issue Sep 26, 2016 · 4 comments
Closed

Bug in type-checker with GADTs and inline records #7372

vicuna opened this issue Sep 26, 2016 · 4 comments
Assignees
Milestone

Comments

@vicuna
Copy link

vicuna commented Sep 26, 2016

Original bug ID: 7372
Reporter: @alainfrisch
Assigned to: @alainfrisch
Status: resolved (set by @alainfrisch on 2017-03-24T14:37:24Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Fixed in version: 4.06.0 +dev/beta1/beta2/rc1
Category: typing
Tags: github
Related to: #6716
Monitored by: @gasche @yallop

Bug description

bug1.mli:
  type _ t =  C: { f: ('a -> [<`X]) t } -> [<`X] t

bug2.ml:
  open Bug1
  let f (C {f}) = ()
ocamlc -c bug1.mlo bug2.ml

gives:

File "bug2.ml", line 3, characters 9-12:
Error: This pattern matches values of type ([< `X ] as 'a, 'b) Bug1.t.C
       but a pattern was expected which matches values of type
         ($C_'a, [< `X ]) Bug1.t.C
       Type [< `X ] as 'a is not compatible with type $C_'a

The problem probably comes from the internal encoding of inline records as regular records (whose parameters are derived from free variables of the inline record).

Note: explicitly qualifying Bug1.C in bug2.ml removes the error message; so does inlining the type definition in bug2.ml.

@vicuna
Copy link
Author

vicuna commented Sep 26, 2016

Comment author: @alainfrisch

Tentative fix proposed in #824

@vicuna
Copy link
Author

vicuna commented Sep 28, 2016

Comment author: @alainfrisch

Another fix in #828

@vicuna
Copy link
Author

vicuna commented Sep 28, 2016

Comment author: @alainfrisch

I'm setting Target Version = 4.04, but I don't think this is necessarily a blocking issue.

@vicuna
Copy link
Author

vicuna commented Mar 24, 2017

Comment author: @alainfrisch

#834

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

2 participants