summaryrefslogtreecommitdiff
path: root/testlabl
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2005-10-31 07:54:59 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2005-10-31 07:54:59 +0000
commit3609f1cc70c31a634ccf8961c18ba2bc187cda01 (patch)
tree358db2be9e20fce0269d298d6d0a0e2acc6e3506 /testlabl
parent7ca09b85f07684084129804369689893963b84c9 (diff)
downloadocaml-3609f1cc70c31a634ccf8961c18ba2bc187cda01.tar.gz
principal
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7209 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'testlabl')
-rw-r--r--testlabl/poly.exp8
-rw-r--r--testlabl/poly.exp28
-rw-r--r--testlabl/poly.ml12
3 files changed, 26 insertions, 2 deletions
diff --git a/testlabl/poly.exp b/testlabl/poly.exp
index ac1dca7cbb..cc124b6581 100644
--- a/testlabl/poly.exp
+++ b/testlabl/poly.exp
@@ -1,4 +1,4 @@
- Objective Caml version 3.09+dev27 (2005-08-13)
+ Objective Caml version 3.10+dev1 (2005-10-26)
# * * * # type 'a t = { t : 'a; }
# type 'a fold = { fold : 'b. f:('b -> 'a -> 'b) -> init:'b -> 'b; }
@@ -433,4 +433,10 @@ Only the first object type has a method b
# Characters 13-83:
Type < m : 'a. [< `A of < > ] as 'a > is not a subtype of type
< m : 'a. [< `A of < p : int > ] as 'a >
+# class c : object method id : 'a -> 'a end
+# type u = c option
+# val just : 'a option -> 'a = <fun>
+# val f : c -> 'a -> 'a = <fun>
+# val g : c -> 'a -> 'a = <fun>
+# val h : < id : 'a; .. > -> 'a = <fun>
#
diff --git a/testlabl/poly.exp2 b/testlabl/poly.exp2
index 0e64a2c354..0a81678120 100644
--- a/testlabl/poly.exp2
+++ b/testlabl/poly.exp2
@@ -1,4 +1,4 @@
- Objective Caml version 3.09+dev27 (2005-08-13)
+ Objective Caml version 3.10+dev1 (2005-10-26)
# * * * # type 'a t = { t : 'a; }
# type 'a fold = { fold : 'b. f:('b -> 'a -> 'b) -> init:'b -> 'b; }
@@ -444,4 +444,10 @@ Only the first object type has a method b
# Characters 13-83:
Type < m : 'a. [< `A of < > ] as 'a > is not a subtype of type
< m : 'a. [< `A of < p : int > ] as 'a >
+# class c : object method id : 'a -> 'a end
+# type u = c option
+# val just : 'a option -> 'a = <fun>
+# val f : c -> 'a -> 'a = <fun>
+# val g : c -> 'a -> 'a = <fun>
+# val h : < id : 'a; .. > -> 'a = <fun>
#
diff --git a/testlabl/poly.ml b/testlabl/poly.ml
index 40645cb836..ae19840fbe 100644
--- a/testlabl/poly.ml
+++ b/testlabl/poly.ml
@@ -554,3 +554,15 @@ let f5 x =
(x : <m:'a. [< `A of <p:int> ] as 'a> :> <m:'a. [< `A of < > ] as 'a>);;
let f6 x =
(x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>);;
+
+(* Not really principal? *)
+class c = object method id : 'a. 'a -> 'a = fun x -> x end;;
+type u = c option;;
+let just = function None -> failwith "just" | Some x -> x;;
+let f x = let l = [Some x; (None : u)] in (just(List.hd l))#id;;
+let g x =
+ let none = match None with y -> ignore [y;(None:u)]; y in
+ let x = List.hd [Some x; none] in (just x)#id;;
+let h x =
+ let none = let y = None in ignore [y;(None:u)]; y in
+ let x = List.hd [Some x; none] in (just x)#id;;