440 lines
15 KiB
Plaintext
440 lines
15 KiB
Plaintext
Objective Caml version 3.10.1+dev0 (2007-05-21)
|
|
|
|
# * * * # type 'a t = { t : 'a; }
|
|
# type 'a fold = { fold : 'b. f:('b -> 'a -> 'b) -> init:'b -> 'b; }
|
|
# val f : 'a list -> 'a fold = <fun>
|
|
# - : int = 6
|
|
# class ['a] ilist :
|
|
'a list ->
|
|
object ('b)
|
|
val l : 'a list
|
|
method add : 'a -> 'b
|
|
method fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
|
end
|
|
# class virtual ['a] vlist :
|
|
object ('b)
|
|
method virtual add : 'a -> 'b
|
|
method virtual fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
|
end
|
|
# class ilist2 :
|
|
int list ->
|
|
object ('a)
|
|
val l : int list
|
|
method add : int -> 'a
|
|
method fold : f:('b -> int -> 'b) -> init:'b -> 'b
|
|
end
|
|
# val ilist2 : 'a list -> 'a vlist = <fun>
|
|
# class ['a] ilist3 :
|
|
'a list ->
|
|
object ('b)
|
|
val l : 'a list
|
|
method add : 'a -> 'b
|
|
method fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
|
end
|
|
# class ['a] ilist4 :
|
|
'a list ->
|
|
object ('b)
|
|
val l : 'a list
|
|
method add : 'a -> 'b
|
|
method fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
|
end
|
|
# class ['a] ilist5 :
|
|
'a list ->
|
|
object ('b)
|
|
val l : 'a list
|
|
method add : 'a -> 'b
|
|
method fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
|
method fold2 : f:('d -> 'a -> 'd) -> init:'d -> 'd
|
|
end
|
|
# class ['a] ilist6 :
|
|
'a list ->
|
|
object ('b)
|
|
val l : 'a list
|
|
method add : 'a -> 'b
|
|
method fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
|
method fold2 : f:('d -> 'a -> 'd) -> init:'d -> 'd
|
|
end
|
|
# class virtual ['a] olist :
|
|
object method virtual fold : f:('a -> 'b -> 'b) -> init:'b -> 'b end
|
|
# class ['a] onil :
|
|
object method fold : f:('a -> 'b -> 'b) -> init:'b -> 'b end
|
|
# class ['a] ocons :
|
|
hd:'a ->
|
|
tl:'a olist ->
|
|
object
|
|
val hd : 'a
|
|
val tl : 'a olist
|
|
method fold : f:('a -> 'b -> 'b) -> init:'b -> 'b
|
|
end
|
|
# class ['a] ostream :
|
|
hd:'a ->
|
|
tl:'a ostream ->
|
|
object
|
|
val hd : 'a
|
|
val tl : 'a ostream
|
|
method empty : bool
|
|
method fold : f:('a -> 'b -> 'b) -> init:'b -> 'b
|
|
end
|
|
# class ['a] ostream1 :
|
|
hd:'a ->
|
|
tl:'b ->
|
|
object ('b)
|
|
val hd : 'a
|
|
val tl : 'b
|
|
method fold : f:('a -> 'c -> 'c) -> init:'c -> 'c
|
|
method hd : 'a
|
|
method tl : 'b
|
|
end
|
|
# class vari : object method m : [< `A | `B | `C ] -> int end
|
|
# class vari : object method m : [< `A | `B | `C ] -> int end
|
|
# module V : sig type v = [ `A | `B | `C ] val m : [< v ] -> int end
|
|
# class varj : object method m : [< V.v ] -> int end
|
|
# module type T =
|
|
sig class vari : object method m : [< `A | `B | `C ] -> int end end
|
|
# module M0 :
|
|
sig class vari : object method m : [< `A | `B | `C ] -> int end end
|
|
# module M : T
|
|
# val v : M.vari = <obj>
|
|
# - : int = 1
|
|
# class point :
|
|
x:int ->
|
|
y:int -> object val x : int val y : int method x : int method y : int end
|
|
# class color_point :
|
|
x:int ->
|
|
y:int ->
|
|
color:string ->
|
|
object
|
|
val color : string
|
|
val x : int
|
|
val y : int
|
|
method color : string
|
|
method x : int
|
|
method y : int
|
|
end
|
|
# class circle :
|
|
#point ->
|
|
r:int ->
|
|
object val p : point val r : int method distance : #point -> float end
|
|
# val p0 : point = <obj>
|
|
val p1 : point = <obj>
|
|
val cp : color_point = <obj>
|
|
val c : circle = <obj>
|
|
val d : float = 11.4536240470737098
|
|
# val f : < m : 'a. 'a -> 'a > -> < m : 'a. 'a -> 'a > = <fun>
|
|
# Characters 41-42:
|
|
This expression has type < m : 'a. 'a -> 'a list > but is here used with type
|
|
< m : 'a. 'a -> 'b >
|
|
The universal variable 'a would escape its scope
|
|
# class id : object method id : 'a -> 'a end
|
|
# class type id_spec = object method id : 'a -> 'a end
|
|
# class id_impl : object method id : 'a -> 'a end
|
|
# class a : object method m : bool end
|
|
and b : object method id : 'a -> 'a end
|
|
# Characters 72-77:
|
|
This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
|
|
# Characters 75-80:
|
|
This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
|
|
# Characters 80-85:
|
|
This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
|
|
# Characters 92-159:
|
|
This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
|
|
# class c : object method m : 'a -> 'b -> 'a end
|
|
# val f1 : id -> int * bool = <fun>
|
|
# val f2 : id -> int * bool = <fun>
|
|
# Characters 24-28:
|
|
This expression has type bool but is here used with type int
|
|
# val f4 : id -> int * bool = <fun>
|
|
# class c : object method m : #id -> int * bool end
|
|
# class id2 : object method id : 'a -> 'a method mono : int -> int end
|
|
# val app : int * bool = (1, true)
|
|
# Characters 4-25:
|
|
The type abbreviation foo is cyclic
|
|
# class ['a] bar : 'a -> object end
|
|
# type 'a foo = 'a foo bar
|
|
# - : (< m : 'b. 'b * 'a > as 'a) -> 'c * 'a = <fun>
|
|
# - : (< m : 'b. 'a * 'b list > as 'a) -> 'a * 'c list = <fun>
|
|
# val f :
|
|
(< m : 'b. 'a * (< n : 'b; .. > as 'b) > as 'a) ->
|
|
'a * (< n : 'c; .. > as 'c) = <fun>
|
|
# - : (< p : 'b. < m : 'b; n : 'a; .. > as 'b > as 'a) ->
|
|
(< m : 'c; n : 'a; .. > as 'c)
|
|
= <fun>
|
|
# - : (< m : 'b. 'b * < p : 'd. 'd * 'c * 'a > as 'c > as 'a) ->
|
|
('f * < p : 'g. 'g * 'e * 'a > as 'e)
|
|
= <fun>
|
|
# - : < m : 'a. < p : 'a; .. > as 'b > -> 'b = <fun>
|
|
# type sum = T of < id : 'a. 'a -> 'a >
|
|
# - : sum -> 'a -> 'a = <fun>
|
|
# type record = { r : < id : 'a. 'a -> 'a >; }
|
|
# - : record -> 'a -> 'a = <fun>
|
|
# - : record -> 'a -> 'a = <fun>
|
|
# class myself : object ('a) method self : 'b -> 'a end
|
|
# class number :
|
|
object ('a)
|
|
val num : int
|
|
method num : int
|
|
method prev : 'a
|
|
method succ : 'a
|
|
method switch : zero:(unit -> 'b) -> prev:('a -> 'b) -> 'b
|
|
end
|
|
# val id : 'a -> 'a = <fun>
|
|
# class c : object method id : 'a -> 'a end
|
|
# class c' : object method id : 'a -> 'a end
|
|
# class d :
|
|
object
|
|
val mutable count : int
|
|
method count : int
|
|
method id : 'a -> 'a
|
|
method old : 'b -> 'b
|
|
end
|
|
# class ['a] olist :
|
|
'a list ->
|
|
object ('b)
|
|
val l : 'a list
|
|
method cons : 'a -> 'b
|
|
method fold : f:('a -> 'c -> 'c) -> init:'c -> 'c
|
|
end
|
|
# val sum : int #olist -> int = <fun>
|
|
# val count : 'a #olist -> int = <fun>
|
|
# val append : 'a #olist -> ('a #olist as 'b) -> 'b = <fun>
|
|
# type 'a t = unit
|
|
# class o : object method x : [> `A ] t -> unit end
|
|
# class c : object method m : d end
|
|
and d : ?x:int -> unit -> object end
|
|
# class d : ?x:int -> unit -> object end
|
|
and c : object method m : d end
|
|
# class type numeral = object method fold : ('a -> 'a) -> 'a -> 'a end
|
|
class zero : object method fold : ('a -> 'a) -> 'a -> 'a end
|
|
class next : #numeral -> object method fold : ('a -> 'a) -> 'a -> 'a end
|
|
# class type node_type = object method as_variant : [> `Node of node_type ] end
|
|
# class node : node_type
|
|
# class node : object method as_variant : [> `Node of node_type ] end
|
|
# type bad = { bad : 'a. 'a option ref; }
|
|
# Characters 17-25:
|
|
This field value has type 'a option ref which is less general than
|
|
'b. 'b option ref
|
|
# type bad2 = { mutable bad2 : 'a. 'a option ref option; }
|
|
# val bad2 : bad2 = {bad2 = None}
|
|
# Characters 13-28:
|
|
This field value has type 'a option ref option which is less general than
|
|
'b. 'b option ref option
|
|
# val f : < m : 'a. < p : 'a * 'b > as 'b > -> 'c -> unit = <fun>
|
|
# val f : < m : 'a. 'a * (< p : int * 'b > as 'b) > -> 'b -> unit = <fun>
|
|
# type 'a t = [ `A of 'a ]
|
|
# class c : object method m : ([> 'a t ] as 'a) -> unit end
|
|
# class c : object method m : ([> 'a t ] as 'a) -> unit end
|
|
# class c : object method m : ([> 'a t ] as 'a) -> 'a end
|
|
# class c : object method m : ([> `A ] as 'a) option -> 'a end
|
|
# Characters 145-166:
|
|
This type scheme cannot quantify 'a :
|
|
it escapes this scope.
|
|
# type ('a, 'b) list_visitor = < caseCons : 'b -> 'b list -> 'a; caseNil : 'a >
|
|
type 'a alist = < visit : 'b. ('b, 'a) list_visitor -> 'b >
|
|
class type ct = object ('a) method fold : ('b -> 'a -> 'b) -> 'b -> 'b end
|
|
type t = { f : 'a 'b. ('b -> (#ct as 'a) -> 'b) -> 'b; }
|
|
# Characters 19-25:
|
|
The type abbreviation t is cyclic
|
|
# class ['a] a : object constraint 'a = [> `A of 'a a ] end
|
|
type t = [ `A of t a ]
|
|
# Characters 71-80:
|
|
Constraints are not satisfied in this type.
|
|
Type ('a, 'b) t should be an instance of ('c, 'c) t
|
|
# type 'a t = 'a
|
|
and u = int t
|
|
# type 'a t constraint 'a = int
|
|
# Characters 26-32:
|
|
Constraints are not satisfied in this type.
|
|
Type 'a u t should be an instance of int t
|
|
# type 'a u = 'a constraint 'a = int
|
|
and 'a v = 'a u t constraint 'a = int
|
|
# type g = int
|
|
# type 'a t = unit constraint 'a = g
|
|
# Characters 26-32:
|
|
Constraints are not satisfied in this type.
|
|
Type 'a u t should be an instance of g t
|
|
# type 'a u = 'a constraint 'a = g
|
|
and 'a v = 'a u t constraint 'a = int
|
|
# Characters 38-58:
|
|
In the definition of v, type 'a list u should be 'a u
|
|
# type 'a t = 'a
|
|
type 'a u = A of 'a t
|
|
# type 'a t = < a : 'a >
|
|
# - : ('a t as 'a) -> 'a t = <fun>
|
|
# type u = 'a t as 'a
|
|
# type t = A | B
|
|
# - : [> `A ] * t -> int = <fun>
|
|
# - : [> `A ] * t -> int = <fun>
|
|
# - : [> `A ] option * t -> int = <fun>
|
|
# - : [> `A ] option * t -> int = <fun>
|
|
# - : t * [< `A | `B ] -> int = <fun>
|
|
# - : [< `A | `B ] * t -> int = <fun>
|
|
# Characters 0-41:
|
|
Warning P: this pattern-matching is not exhaustive.
|
|
Here is an example of a value that is not matched:
|
|
(`AnyExtraTag, `AnyExtraTag)
|
|
- : [> `A | `B ] * [> `A | `B ] -> int = <fun>
|
|
# Characters 0-29:
|
|
Warning P: this pattern-matching is not exhaustive.
|
|
Here is an example of a value that is not matched:
|
|
(_, 0)
|
|
Characters 21-24:
|
|
Warning U: this match case is unused.
|
|
- : [< `B ] * int -> int = <fun>
|
|
# Characters 0-29:
|
|
Warning P: this pattern-matching is not exhaustive.
|
|
Here is an example of a value that is not matched:
|
|
(0, _)
|
|
Characters 21-24:
|
|
Warning U: this match case is unused.
|
|
- : int * [< `B ] -> int = <fun>
|
|
# Characters 69-135:
|
|
Constraints are not satisfied in this type.
|
|
Type
|
|
([> `B of 'a ], 'a) b as 'a
|
|
should be an instance of
|
|
(('b, [> `A of 'b ] as 'c) a as 'b, 'c) b
|
|
# class type ['a, 'b] a =
|
|
object
|
|
constraint 'a = ('a, 'b) #a
|
|
constraint 'b = ('a, 'b) #b
|
|
method as_a : ('a, 'b) a
|
|
method b : 'b
|
|
end
|
|
and ['a, 'b] b =
|
|
object
|
|
constraint 'a = ('a, 'b) #a
|
|
constraint 'b = ('a, 'b) #b
|
|
method a : 'a
|
|
method as_b : ('a, 'b) b
|
|
end
|
|
class type ['a] ca =
|
|
object ('b)
|
|
constraint 'a = ('b, 'a) #b
|
|
method as_a : ('b, 'a) a
|
|
method b : 'a
|
|
end
|
|
class type ['a] cb =
|
|
object ('b)
|
|
constraint 'a = ('a, 'b) #a
|
|
method a : 'a
|
|
method as_b : ('a, 'b) b
|
|
end
|
|
type bt = 'a ca cb as 'a
|
|
# class c : object method m : int end
|
|
# val f : unit -> c = <fun>
|
|
# val f : unit -> c = <fun>
|
|
# Characters 11-60:
|
|
Warning X: the following private methods were made public implicitly:
|
|
n.
|
|
val f : unit -> < m : int; n : int > = <fun>
|
|
# Characters 11-56:
|
|
This object is expected to have type c but has actually type
|
|
< m : int; n : 'a >
|
|
The first object type has no method n
|
|
# Characters 11-69:
|
|
This object is expected to have type < n : int > but has actually type
|
|
< m : 'a >
|
|
The second object type has no method n
|
|
# Characters 66-124:
|
|
This object is expected to have type < x : int; .. > but has actually type
|
|
< x : int >
|
|
Self type cannot be unified with a closed object type
|
|
# val o : < x : int > = <obj>
|
|
# Characters 76-77:
|
|
This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
|
|
but is here used with type
|
|
< m : 'b. 'b * (< m : 'b * < m : 'd. 'd * 'c > > as 'c) >
|
|
Types for method m are incompatible
|
|
# Characters 176-177:
|
|
This expression has type foo' = < m : 'a. 'a * 'a foo >
|
|
but is here used with type bar' = < m : 'a. 'a * 'a bar >
|
|
Type 'a foo = < m : 'a * 'a foo > is not compatible with type
|
|
'a bar = < m : 'a * < m : 'b. 'b * 'a bar > >
|
|
Type 'a foo = < m : 'a * 'a foo > is not compatible with type
|
|
< m : 'b. 'b * 'a bar >
|
|
Types for method m are incompatible
|
|
# Characters 67-68:
|
|
This expression has type < m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
|
|
but is here used with type
|
|
< m : 'a. 'a * ('a * < m : 'c. 'c * ('c * 'd) >) > as 'd
|
|
Types for method m are incompatible
|
|
# Characters 66-67:
|
|
This expression has type < m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
|
|
but is here used with type
|
|
< m : 'a. 'a * ('a * < m : 'c. 'c * ('a * 'd) >) > as 'd
|
|
Types for method m are incompatible
|
|
# Characters 51-52:
|
|
This expression has type < m : 'b. 'b * ('b * 'a) > as 'a
|
|
but is here used with type < m : 'b. 'b * ('b * < m : 'd. 'd * 'c > as 'c) >
|
|
Types for method m are incompatible
|
|
# Characters 14-115:
|
|
Type < m : 'a. 'a -> ('a * (< m : 'd. 'd -> 'b as 'e > as 'c) as 'b) >
|
|
is not a subtype of type < m : 'a. 'a -> ('a * 'f as 'h) as 'g > as 'f
|
|
# Characters 88-150:
|
|
Signature mismatch:
|
|
Modules do not match:
|
|
sig val f : (< m : 'b. 'b * ('b * 'a) > as 'a) -> unit end
|
|
is not included in
|
|
sig val f : < m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) > -> unit end
|
|
Values do not match:
|
|
val f : (< m : 'b. 'b * ('b * 'a) > as 'a) -> unit
|
|
is not included in
|
|
val f : < m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) > -> unit
|
|
# Characters 78-132:
|
|
Signature mismatch:
|
|
Modules do not match:
|
|
sig type t = < m : 'b. 'b * ('b * 'a) > as 'a end
|
|
is not included in
|
|
sig type t = < m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) > end
|
|
Type declarations do not match:
|
|
type t = < m : 'b. 'b * ('b * 'a) > as 'a
|
|
is not included in
|
|
type t = < m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
|
|
# module M : sig type 'a t type u = < m : 'a. 'a t > end
|
|
# module M : sig type 'a t val f : < m : 'a. 'a t > -> int end
|
|
# module M : sig type 'a t val f : < m : 'a. 'a t > -> int end
|
|
# val f :
|
|
(< m : 'b. 'b -> (< m : 'b. 'b -> 'c * < > > as 'c) * < .. >; .. > as 'a) ->
|
|
'a -> bool = <fun>
|
|
# type t = [ `A | `B ]
|
|
# type v = private [> t ]
|
|
# - : t -> v = <fun>
|
|
# type u = private [< t ]
|
|
# - : u -> v = <fun>
|
|
# Characters 9-21:
|
|
Type v = [> `A | `B ] is not a subtype of type u = [< `A | `B ]
|
|
# type v = private [< t ]
|
|
# Characters 9-21:
|
|
Type u = [< `A | `B ] is not a subtype of type v = [< `A | `B ]
|
|
# type p = < x : p >
|
|
# type q = private < x : p; .. >
|
|
# - : q -> p = <fun>
|
|
# Characters 9-21:
|
|
Type p = < x : p > is not a subtype of type q = < x : p; .. >
|
|
# Characters 14-100:
|
|
Type < m : 'a. (< p : int; .. > as 'a) -> int > is not a subtype of type
|
|
< m : 'b. (< p : int; q : int; .. > as 'b) -> int >
|
|
# val f2 :
|
|
< m : 'a. (< p : < a : int >; .. > as 'a) -> int > ->
|
|
< m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int > = <fun>
|
|
# Characters 13-107:
|
|
Type < m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int >
|
|
is not a subtype of type < m : 'a. (< p : < a : int >; .. > as 'a) -> int >
|
|
# Characters 11-55:
|
|
Type < p : < a : int; b : int >; .. > is not a subtype of type
|
|
< p : < a : int >; .. >
|
|
The second object type has no method b
|
|
# val f5 :
|
|
< m : 'a. [< `A of < p : int > ] as 'a > ->
|
|
< m : 'a. [< `A of < > ] as 'a > = <fun>
|
|
# 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>
|
|
# * * * * * * * * * * * * * * * * * * *
|