diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2002-12-10 10:17:48 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2002-12-10 10:17:48 +0000 |
commit | 19a586da26a9b9ddc422eff91f5255e028d83a74 (patch) | |
tree | 343c88c85e527843b15d5206ce4198e3f9d3bc15 | |
parent | 513ae1bbfe067bb3c8cd4ccab3883ec0aca370f9 (diff) |
add test cases
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5330 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | testlabl/multimatch.ml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/testlabl/multimatch.ml b/testlabl/multimatch.ml new file mode 100644 index 000000000..b0f36e3f3 --- /dev/null +++ b/testlabl/multimatch.ml @@ -0,0 +1,34 @@ +let f x = + (multimatch x with `A -> 1 | `B -> true), + (multimatch x with `A -> 1. | `B -> "1");; + +(* OK *) +module M : sig + val f : + [< `A & 'a = int & 'b = float | `B & 'b =string & 'a = bool] -> 'a * 'b +end = struct let f = f end;; + +(* Bad *) +module M : sig + val f : + [< `A & 'a = int & 'b = float | `B & 'b =string & 'a = int] -> 'a * 'b +end = struct let f = f end;; + + +let f = multifun + `A -> (multifun `C -> 1 | `D -> 1.) + | `B -> (multifun `C -> true | `D -> "1");; + +(* OK *) +module M : sig + val f : + [< `A & 'b = [< `C & 'a = int | `D & 'a = float & 'c = bool] -> 'a + | `B & 'b = [< `C & 'c = bool | `D & 'c = string] -> 'c] -> 'b +end = struct let f = f end;; + +(* Bad *) +module M : sig + val f : + [< `A & 'b = [< `C & 'a = int | `D & 'a = bool] -> 'a + | `B & 'b = [< `C & 'c = bool | `D & 'c = string] -> 'c] -> 'b +end = struct let f = f end;; |