summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-gadts/pr9759.ml
blob: cf68cebbc5a2b1cc94c2ceef4b65e3ba23a5e856 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(* TEST
   * expect
*)

(* #9759 by Thomas Refis *)

type 'a general = { indir: 'a desc; unit: unit }
and 'a desc =
  | C : unit general -> unit desc ;;
[%%expect{|
type 'a general = { indir : 'a desc; unit : unit; }
and 'a desc = C : unit general -> unit desc
|}]

let rec foo : type k . k general -> k general = fun g ->
  match g.indir with
  | C g' ->
      let new_g' = foo g' in
      if true then
        {g with indir = C new_g'}
      else
          new_g'
  | indir ->
     {g with indir} ;;
[%%expect{|
Line 9, characters 4-9:
9 |   | indir ->
        ^^^^^
Warning 11 [redundant-case]: this match case is unused.

val foo : 'k general -> 'k general = <fun>
|}]