diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2013-02-26 12:45:45 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2013-02-26 12:45:45 +0000 |
commit | 5cab09944e2f6aadedeac36b5b122c0494bbcc17 (patch) | |
tree | 04594d37a7e54489f0b25fed037378ccb16cf8d0 | |
parent | 5f859e648ac55362efe2f5f0991d73319ca9807d (diff) | |
download | ocaml-5cab09944e2f6aadedeac36b5b122c0494bbcc17.tar.gz |
add a few more cases
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13317 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | testsuite/tests/exotic-syntax/exotic.ml | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/testsuite/tests/exotic-syntax/exotic.ml b/testsuite/tests/exotic-syntax/exotic.ml index dcf7e94adf..7b0d9633b4 100644 --- a/testsuite/tests/exotic-syntax/exotic.ml +++ b/testsuite/tests/exotic-syntax/exotic.ml @@ -1,5 +1,5 @@ -(* Exotic OCaml syntax constructs that are not used in the source of *) -(* the OCaml distribution (even in the tests). *) +(* Exotic OCaml syntax constructs found in the manual that are not *) +(* used in the source of the OCaml distribution (even in the tests). *) (* Spaces between the parts of the ?label: token in a typexpr. *) type t = ? label : int -> int -> int;; @@ -25,3 +25,23 @@ class virtual c4 = object val mutable virtual x : int end;; module type T = sig module type U end;; + +(* associativity rules for patterns *) +match Some (Some 1) with Some Some x -> x;; +match Some (`Tag 1) with Some `Tag x -> x;; +match `Tag (Some 1) with `Tag Some x -> x;; +match `Tag (`Tag 1) with `Tag `Tag x -> x;; + + +(* Even more exotic: not even found in the manual, but used in some *) +(* programs in testsuite/external/. *) + +(* local functor *) +let module M (M1 : sig end) (M2 : sig end) = struct end in ();; + +(* let-binding with a type coercion *) +let f x :> int = x + 1;; +let f x : int :> int = x + 1;; + +(* "begin end" as an alias for "()" *) +let x = begin end;; |