summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-gadts/test.ml.principal.reference
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typing-gadts/test.ml.principal.reference')
-rw-r--r--testsuite/tests/typing-gadts/test.ml.principal.reference32
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/tests/typing-gadts/test.ml.principal.reference b/testsuite/tests/typing-gadts/test.ml.principal.reference
index fae7dca835..6db24e1a5d 100644
--- a/testsuite/tests/typing-gadts/test.ml.principal.reference
+++ b/testsuite/tests/typing-gadts/test.ml.principal.reference
@@ -128,4 +128,36 @@ Error: This expression has type int but an expression was expected of type a
# val f : 'a t -> 'a -> 'a = <fun>
# val f : 'a t -> 'a -> 'a = <fun>
# val f : 'a t -> 'a -> int = <fun>
+# type 'a t = A of int | B of bool | C of float | D of 'a
+type 'a ty =
+ TE : 'b ty -> 'b array ty
+ | TA : int ty
+ | TB : bool ty
+ | TC : float ty
+ | TD : string -> bool ty
+val f : 'a ty -> 'a t -> int = <fun>
+# Characters 51-202:
+ ..match x, y with
+ | _, A z -> z
+ | _, B z -> if z then 1 else 2
+ | _, C z -> truncate z
+ | TE TC, D [|1.0|] -> 14
+ | TA, D 0 -> -1
+ | TA, D z -> z
+Warning 8: this pattern-matching is not exhaustive.
+Here is an example of a value that is not matched:
+(TE TC, D [| |])
+val f : 'a ty -> 'a t -> int = <fun>
+# Characters 147-154:
+ | D [|1.0|], TE TC -> 14
+ ^^^^^^^
+Error: This pattern matches values of type 'a array
+ but a pattern was expected which matches values of type a
+# Characters 259-266:
+ | {left=TE TC; right=D [|1.0|]} -> 14
+ ^^^^^^^
+Error: This pattern matches values of type 'a array
+ but a pattern was expected which matches values of type a
+# type ('a, 'b) pair = { left : 'a; right : 'b; }
+val f : 'a ty -> 'a t -> int = <fun>
#