Skip to content

The partial-match warning is now triggered when using GADTs in trunk #14224

@kit-ty-kate

Description

@kit-ty-kate

Both of the following test-cases raise the partial-match (8) warning on both f and g when using trunk (a7e0173). This seems contrary to GADT's design and this doesn't happen in any of the previous version of OCaml.

type a
type b

type 'a test =
  | Gen of int
  | A : a -> a test
  | B : b -> b test

let f = function
  | Gen _ -> ()
  | A _ -> ()

let g = function
  | Gen _ -> ()
  | B _ -> ()
type a
type b

type 'a test =
  | A : a -> a test
  | B : b -> b test

let f : a test -> unit = function
  | A _ -> ()

let g : b test -> unit = function
  | B _ -> ()

Is this expected? If so, what is the new construct for this kind of pattern?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions