Skip to content

Interaction between GADTs and polymorphic variants #5724

@vicuna

Description

@vicuna

Original bug ID: 5724
Reporter: @yallop
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:18:42Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.00.0
Fixed in version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Child of: #5998

Bug description

OCaml reports an error for the last line of the following program:

type _ t =
| A : int t
| B : [`C] -> bool t

let isA (type a) (r : a t) = match r with
| A -> true
| B `C -> false
^^^^
Error: This pattern matches values of type bool t
but a pattern was expected which matches values of type int t

If the `C in the pattern is replaced with an underscore, the program is accepted.

Metadata

Metadata

Assignees

Labels

bugtyping-GADTSGADT typing and exhaustiveness bugs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions