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

pattern matching problem with GADT #5332

vicuna opened this Issue Aug 9, 2011 · 1 comment


None yet
1 participant
Copy link

vicuna commented Aug 9, 2011

Original bug ID: 5332
Reporter: @diml
Status: closed (set by @garrigue on 2011-08-09T14:01:47Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

I was playing with the svn version of ocaml and get the following error:

type ('env, 'a) var =
| Zero : ('a * 'env, 'a) var
| Succ : ('env, 'a) var -> ('b * 'env, 'a) var

type ('env, 'a) typ =
| Tint : ('env, int) typ
| Tbool : ('env, bool) typ
| Tvar : ('env, 'a) var -> ('env, 'a) typ

let f : type env a. (env, a) typ -> (env, a) typ -> int = fun ta tb ->
match ta, tb with
| Tint, Tint -> 0
| Tbool, Tbool -> 1
| Tvar var, tb -> 2

let x = f Tint (Tvar Zero)

Here i get no warning when defining f, and x is evaluated to 0. If i remove the Tbool constructor, then i get a warning and a Match_failure exception.


This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Aug 9, 2011

Comment author: @garrigue

Stupid bug in the auxiliary function Parmatch.combinations.

Thanks for your report.

@vicuna vicuna closed this Aug 9, 2011

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.