Skip to content

GADT type information is not used to detect unused match cases #6220

@vicuna

Description

@vicuna

Original bug ID: 6220
Reporter: @lpw25
Assigned to: @garrigue
Status: closed (set by @garrigue on 2015-12-04T00:46:13Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.01.0
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: typing
Child of: #5998 #6437
Monitored by: @gasche @hcarty

Bug description

It seems that warning 11 ("this match case is unused") does not take account of the type information of GADTs.

For example:

type 'a t = I : int t | F : float t;;

type 'a t = I : int t | F : float t

let f : int t -> int = function

  I -> 1;;
val f : int t -> int = <fun>

let f : int t -> int = function

  I -> 1
| _ -> 2;;
  val f : int t -> int = <fun>

I would have expected the second declaration of f to raise warning 11, but it does not.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions