principal

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7209 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Jacques Garrigue 2005-10-31 07:54:59 +00:00
parent 7ca09b85f0
commit 3609f1cc70
3 changed files with 26 additions and 2 deletions

View File

@ -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>
#

View File

@ -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>
#

View File

@ -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;;