summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-misc/polyvars.ml.reference
blob: 27c4cd4304a2b7feee5034f18ef28faf91e4811b (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

# type ab = [ `A | `B ]
# Characters 32-35:
  let f (x : [`A]) = match x with #ab -> 1;;
                                  ^^^
Error: This pattern matches values of type [? `A | `B ]
       but a pattern was expected which matches values of type [ `A ]
       The second variant type does not allow tag(s) `B
# Characters 31-34:
  let f x = ignore (match x with #ab -> 1); ignore (x : [`A]);;
                                 ^^^
Error: This pattern matches values of type [? `B ]
       but a pattern was expected which matches values of type [ `A ]
       The second variant type does not allow tag(s) `B
# Characters 34-36:
  let f x = ignore (match x with `A|`B -> 1); ignore (x : [`A]);;
                                    ^^
Error: This pattern matches values of type [? `B ]
       but a pattern was expected which matches values of type [ `A ]
       The second variant type does not allow tag(s) `B
#   Characters 50-52:
  let f (x : [< `A | `B]) = match x with `A | `B | `C -> 0;; (* warn *)
                                                   ^^
Warning 12: this sub-pattern is unused.
val f : [< `A | `B ] -> int = <fun>
# Characters 47-49:
  let f (x : [`A | `B]) = match x with `A | `B | `C -> 0;; (* fail *)
                                                 ^^
Error: This pattern matches values of type [? `C ]
       but a pattern was expected which matches values of type [ `A | `B ]
       The second variant type does not allow tag(s) `C
#