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

Fatal error: exception Ctype.Unify(_) #7695

Closed
vicuna opened this issue Dec 21, 2017 · 5 comments
Closed

Fatal error: exception Ctype.Unify(_) #7695

vicuna opened this issue Dec 21, 2017 · 5 comments
Assignees
Milestone

Comments

@vicuna
Copy link

vicuna commented Dec 21, 2017

Original bug ID: 7695
Reporter: copy
Assigned to: @garrigue
Status: resolved (set by @xavierleroy on 2017-12-28T18:37:46Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.06.0
Target version: 4.07.0+dev/beta2/rc1/rc2
Fixed in version: 4.07.0+dev/beta2/rc1/rc2
Category: typing
Has duplicate: #7766
Child of: #6608
Monitored by: @nojb @gasche

Bug description

The following code produce a compiler error ("Fatal error: exception Ctype.Unify(_)").

let _ =
let arb = QCheck.char in
let gen = QCheck.Gen.int in
{ arb with gen }

Steps to reproduce

  1. Install qcheck 0.7 (opam install qcheck)
  2. Save the code as test.ml
  3. Run: ocamlfind ocamlc -c -package qcheck test.ml
@vicuna
Copy link
Author

vicuna commented Dec 21, 2017

Comment author: @nojb

Simpler repro
$ rlwrap ocaml
OCaml version 4.06.0

type 'a t = { f : 'a; g : 'a };;

type 'a t = { f : 'a; g : 'a; }

let x = { f = 12; g = 43 };;

val x : int t = {f = 12; g = 43}

{x with f = "hola"};;

Fatal error: exception Ctype.Unify(_)
$

@vicuna
Copy link
Author

vicuna commented Dec 21, 2017

Comment author: @nojb

Bug introduced in 844016f
(MPR #6608).

@vicuna
Copy link
Author

vicuna commented Dec 22, 2017

Comment author: @garrigue

Thanks @nojebar.
Here is a PR that fixes the problem: #1541

Note that the output of the test is no there yet, as expect tests do not seem to work currently...

@vicuna
Copy link
Author

vicuna commented Dec 22, 2017

Comment author: @garrigue

Also, looking at the code, I think that the logic could be better: i.e., first refine the return type for absent fields, and then use this information to type overridden fields.
But this is another story.

@vicuna
Copy link
Author

vicuna commented Dec 28, 2017

Comment author: @xavierleroy

GPR merged in trunk, will be in 4.07

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