Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

reorganize and add a few tests

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13454 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
commit f344eb755c7ad3f59f0d208b0fce561a3fdc55ad 1 parent a765dca
Damien Doligez authored
Showing with 37 additions and 29 deletions.
  1. +37 −29 testsuite/tests/exotic-syntax/exotic.ml
View
66 testsuite/tests/exotic-syntax/exotic.ml
@@ -41,9 +41,36 @@ function (+) -> (+);;
function _ as (+) -> (+);;
for (+) = 0 to 1 do () done;;
+(* access a class-type through an extended-module-path *)
+module F (X : sig end) = struct
+ class type t = object end
+end;;
+module X = struct end;;
+class type u = F(X).t;;
+
+(* conjunctive constraints on tags (used by the compiler to print some
+ inferred types *)
+type 'a t2 = [< `A of int & int & int ] as 'a;;
+
+(* same for a parameterless tag (triggers a very strange error message) *)
+(*type ('a, 'b) t3 = [< `A of & 'b ] as 'a;;*)
+
+(* negative float constant in a pattern *)
+function -1.0 -> 1 | _ -> 2;;
+
+(* combining language extensions (sec. 7.13 and 7.17) *)
+object
+ method f = 1
+ method! f : type t . int = 2
+end;;
+
+(* private polymorphic method with local type *)
+object method private f : type t . int = 1 end;;
+
(* More exotic: not even found in the manual (up to version 4.00),
- but used in some programs in testsuite/external/. *)
+ but used in some programs found in the wild.
+*)
(* local functor *)
let module M (M1 : sig end) = struct end in ();;
@@ -69,39 +96,16 @@ class virtual c = object
method virtual private g : int
end;;
-(* access a class-type through an extended-module-path *)
-module F (X : sig end) = struct
- class type t = object end
-end;;
-module X = struct end;;
-class type u = F(X).t;;
-
-(* conjunctive constraints on tags (used by the compiler to print some
- inferred types *)
-type 'a t2 = [< `A of int & int & int ] as 'a;;
-
-(* same for a parameterless tag (triggers a very strange error message) *)
-(*type ('a, 'b) t3 = [< `A of & 'b ] as 'a;;*)
-
-(* negative float constant in a pattern *)
-function -1.0 -> 1 | _ -> 2;;
-
-(* combining language extensions (sec. 7.13 and 7.17) *)
-object
- method f = 1
- method! f : type t . int = 2
-end;;
-
-(* private polymorphic method with local type *)
-object method private f : type t . int = 1 end;;
+(* Double-semicolon at the beginning of a module body [ocp-indent] *)
+module X = struct ;; end;;
(**********************
-(* Most exotic: not found in the manual (up to 4.00) and not used by anyone,
- but still implemented by the compiler. *)
+(* Most exotic: not found in the manual (up to 4.00) and not used
+ deliberately by anyone, but still implemented by the compiler. *)
-(* whitespace inside val!, method!, inherit! *)
+(* whitespace inside val!, method!, inherit! [found in ocamlspot] *)
object
val x = 1
val ! x = 2
@@ -110,6 +114,10 @@ object
inherit ! object val x = 3 end
end;;
+(* Using () as a constructor name [found in gettext] *)
+type t = ();;
+let x : t = ();;
+
(* Using :: as a constructor name *)
type t = :: of int * int;;
Please sign in to comment.
Something went wrong with that request. Please try again.