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 when unifying an intersection type with a bool due to "=" or pattern-matching with true or false #7937

Closed
vicuna opened this issue Mar 5, 2019 · 4 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Mar 5, 2019

Original bug ID: 7937
Reporter: georges.duperon
Assigned to: @Octachron
Status: resolved (set by @Octachron on 2019-03-07T11:09:56Z)
Resolution: fixed
Priority: normal
Severity: crash
Platform: Linux
OS: Debian
OS Version: Debian 9
Version: 4.07.0
Fixed in version: 4.09.0+dev
Category: typing
Monitored by: @nojb @gasche

Bug description

Fatal error: exception Ctype.Unify(_)

Triggered by this minimized version (credits go to Paul Laforgue):

type 'a fb = 'a constraint 'a = [< `K of int & 'a];;
let g : 'a. 'a fb -> bool = fun v -> v = true;;

More verbose version:

type ('a, 'select) fb = 'a constraint 'select = [< L of int & 'a | R of bool & 'a ];;
let g : 'a 'select . ('a, 'select) fb -> bool = fun v -> v = true;;

Steps to reproduce

$ cat oops.ml
type 'a fb = 'a constraint 'a = [< `K of int & 'a];;
let g : 'a. 'a fb -> bool = fun v -> v = true;;
$ ocamlc -i oops.ml
Fatal error: exception Ctype.Unify(_)

@vicuna
Copy link
Author

vicuna commented Mar 5, 2019

Comment author: @gasche

I just tried, the same testcase still fails on trunk ( 4.09.0+dev0-2019-01-18 ).

@vicuna
Copy link
Author

vicuna commented Mar 5, 2019

Comment author: @trefis

And the failure goes back at least to 4.02, so I'd guess it's been here "forever".

@vicuna
Copy link
Author

vicuna commented Mar 5, 2019

Comment author: @Octachron

This was introduced in 4.01 with variants and record disambiguation: #2287 .

@vicuna
Copy link
Author

vicuna commented Mar 7, 2019

Comment author: @Octachron

This uncaught exception is fixed in 4.09 by the PR above. Thanks for the report!

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