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 Assert_failure("typing/ctype.ml", 1891, 19) #6163

Closed
vicuna opened this issue Sep 6, 2013 · 1 comment
Closed

Fatal error: exception Assert_failure("typing/ctype.ml", 1891, 19) #6163

vicuna opened this issue Sep 6, 2013 · 1 comment
Assignees

Comments

@vicuna
Copy link

@vicuna vicuna commented Sep 6, 2013

Original bug ID: 6163
Reporter: @lpw25
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2016-12-07T10:37:13Z)
Resolution: fixed
Priority: normal
Severity: crash
Version: 4.01.0+beta/+rc
Fixed in version: 4.01.0+dev
Category: typing
Related to: #6716

Bug description

The following causes an exception in the toplevel:

      OCaml version 4.01.0+rc1

type _ nat =

  Zero : [`Zero] nat
| Succ : 'a nat -> [`Succ of 'a] nat;;
type _ nat = Zero : [ `Zero ] nat | Succ : 'a nat -> [ `Succ of 'a ] nat

let f x =

  let module Aux = struct
    type aux = Aux : [ `Succ of [< `Succ of [< `Succ of [< `Succ of [`Zero] | `Zero] | `Zero] | `Zero] ] nat -> aux
  end in
  let f (type t) ((Aux.Aux x) : Aux.aux) =
    match x with
      Succ Zero -> "1"
    | Succ (Succ Zero) -> "2"
    | Succ (Succ (Succ Zero)) -> "3"
    | Succ (Succ (Succ (Succ Zero))) -> "4"
  in
    f (Aux.Aux x);;
                    Fatal error: exception Assert_failure("typing/ctype.ml", 1891, 19)

Process ocaml-toplevel exited abnormally with code 2

@vicuna
Copy link
Author

@vicuna vicuna commented Sep 6, 2013

Comment author: @garrigue

Fixed in trunk and 4.01, revision 14067.

Note however that this does not solve the fundamental problem: at this point refinement of polymorphic variants with an upper bound is not supported for GADTs.
As a result, the function is accepted, but the exhaustiveness check fails.
Full support of polymorphic variants require changing some invariants, so this cannot be done in 4.01.

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

Successfully merging a pull request may close this issue.

None yet
2 participants