Skip to content

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

Closed

Description

@vicuna

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

Activity

  1. vicuna commented on Dec 21, 2017

    @vicuna
    Author

    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(_)
    $

  2. vicuna commented on Dec 21, 2017

    @vicuna
    Author

    Comment author: @nojb

    Bug introduced in 844016f
    (MPR #6608).

  3. vicuna commented on Dec 22, 2017

    @vicuna
    Author

    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...

  4. vicuna commented on Dec 22, 2017

    @vicuna
    Author

    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.

  5. vicuna commented on Dec 28, 2017

    @vicuna
    Author

    Comment author: @xavierleroy

    GPR merged in trunk, will be in 4.07

  6. added this to the 4.07.0 milestone on Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions