mutated_ocaml / testsuite / tests / typing-poly / poly.ml.reference

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
#   * * *       #   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 ['b] ilist :
  'b list ->
  object ('c)
    val l : 'b list
    method add : 'b -> 'c
    method fold : f:('a -> 'b -> 'a) -> init:'a -> 'a
  end
#         class virtual ['a] vlist :
  object ('c)
    method virtual add : 'a -> 'c
    method virtual fold : f:('b -> 'a -> 'b) -> init:'b -> 'b
  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 ('c)
    val l : 'a list
    method add : 'a -> 'c
    method fold : f:('b -> 'a -> 'b) -> init:'b -> 'b
  end
#               class ['a] ilist4 :
  'a list ->
  object ('c)
    val l : 'a list
    method add : 'a -> 'c
    method fold : f:('b -> 'a -> 'b) -> init:'b -> 'b
  end
#                 class ['a] ilist5 :
  'a list ->
  object ('c)
    val l : 'a list
    method add : 'a -> 'c
    method fold : f:('b -> 'a -> 'b) -> init:'b -> 'b
    method fold2 : f:('b -> 'a -> 'b) -> init:'b -> 'b
  end
#                 class ['a] ilist6 :
  'a list ->
  object ('c)
    val l : 'a list
    method add : 'a -> 'c
    method fold : f:('b -> 'a -> 'b) -> init:'b -> 'b
    method fold2 : f:('b -> 'a -> 'b) -> init:'b -> 'b
  end
#       class virtual ['a] olist :
  object method virtual fold : f:('a -> 'c -> 'c) -> init:'c -> 'c end
#         class ['a] onil :
  object method fold : f:('a -> 'c -> 'c) -> init:'c -> 'c end
#             class ['a] ocons :
  hd:'a ->
  tl:'a olist ->
  object
    val hd : 'a
    val tl : 'a olist
    method fold : f:('a -> 'c -> 'c) -> init:'c -> 'c
  end
#               class ['a] ostream :
  hd:'a ->
  tl:'a ostream ->
  object
    val hd : 'a
    val tl : < empty : bool; fold : 'c. f:('a -> 'c -> 'c) -> init:'c -> 'c >
    method empty : bool
    method fold : f:('a -> 'c -> 'c) -> init:'c -> 'c
  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 : 'b. 'b -> 'b > = <fun>
#   Characters 41-42:
  let f (x : < m : 'a. 'a -> 'a list >) = (x : < m : 'b. 'b -> 'c >)
                                           ^
Error: This expression has type < m : 'b. 'b -> 'b list >
       but an expression was expected of type < m : 'b. 'b -> 'c >
       The universal variable 'b 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:
    method id x = x
              ^^^^^
Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
#         Characters 75-80:
    method id x = x
              ^^^^^
Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
#           Characters 80-85:
    method id _ = x
              ^^^^^
Error: This method has type 'b -> 'b which is less general than 'a. 'a -> 'a
#                 Characters 92-159:
  ............x =
      match r with
        None -> r <- Some x; x
      | Some y -> y
Error: This method has type 'b -> 'b which is less general than 'a. 'a -> 'a
#         class c : object method m : 'a -> 'b -> 'a end
#     val f1 : id -> int * bool = <fun>
#   val f2 : id -> int * bool = <fun>
#   Characters 24-28:
  let f3 f = f#id 1, f#id true
                          ^^^^
Error: This expression has type bool but an expression was expected of 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:
  type 'a foo = 'a foo list
      ^^^^^^^^^^^^^^^^^^^^^
Error: The type abbreviation foo is cyclic
#     class ['a] bar : 'a -> object  end
#   type 'a foo = 'a foo bar
#   - : (< m : 'a. 'a * 'b > as 'b) -> 'c * 'b = <fun>
# - : (< m : 'a. 'b * 'a list > as 'b) -> 'b * '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 : 'a. 'a * < p : 'b. 'b * 'd * 'c > as 'd > as 'c) ->
    ('f * < p : 'b. 'b * 'e * 'c > 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 ('b) method self : 'a -> 'b end
#                       class number :
  object ('b)
    val num : int
    method num : int
    method prev : 'b
    method succ : 'b
    method switch : zero:(unit -> 'a) -> prev:('b -> 'a) -> 'a
  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 : 'a -> 'a
  end
#             class ['a] olist :
  'a list ->
  object ('c)
    val l : 'a list
    method cons : 'a -> 'c
    method fold : f:('a -> 'b -> 'b) -> init:'b -> 'b
  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:
  let bad = {bad = ref None};;
                   ^^^^^^^^
Error: This field value has type 'b option ref which is less general than
         'a. 'a option ref
# type bad2 = { mutable bad2 : 'a. 'a option ref option; }
# val bad2 : bad2 = {bad2 = None}
# Characters 13-28:
  bad2.bad2 <- Some (ref None);;
               ^^^^^^^^^^^^^^^
Error: This field value has type 'b option ref option
       which is less general than 'a. 'a option ref option
#       val f : < m : 'a. < p : 'a * 'c > as 'c > -> 'b -> 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:
  object method virtual visit : 'a.('a visitor -> 'a) end;;
                                ^^^^^^^^^^^^^^^^^^^^^
Error: The universal type variable 'a cannot be generalized:
       it escapes its scope.
#                 type ('a, 'b) list_visitor = < caseCons : 'b -> 'b list -> 'a; caseNil : 'a >
type 'b alist = < visit : 'a. ('a, 'b) list_visitor -> 'a >
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 20-25:
  type t = u and u = t;;
       ^^^^^
Error: 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:
  type ('a,'b) t constraint 'a = 'b and ('a,'b) u = ('a,'b) t;;
                                                    ^^^^^^^^^
Error: 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:
  type 'a u = 'a and 'a v = 'a u t;;
                            ^^^^^^
Error: 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:
  type 'a u = 'a and 'a v = 'a u t;;
                            ^^^^^^
Error: 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 = g
#     Characters 38-58:
  type 'a u = < m : 'a v > and 'a v = 'a list u;;
      ^^^^^^^^^^^^^^^^^^^^
Error: 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:
  function (`A|`B), _ -> 0 | _,(`A|`B) -> 1;;
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 8: 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:
  function `B,1 -> 1 | _,1 -> 2;;
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(_, 0)
Characters 21-24:
  function `B,1 -> 1 | _,1 -> 2;;
                       ^^^
Warning 11: this match case is unused.
- : [< `B ] * int -> int = <fun>
# Characters 0-29:
  function 1,`B -> 1 | 1,_ -> 2;;
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(0, _)
Characters 21-24:
  function 1,`B -> 1 | 1,_ -> 2;;
                       ^^^
Warning 11: this match case is unused.
- : int * [< `B ] -> int = <fun>
#       Characters 69-135:
  type ('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b]
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: 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 = < as_a : ('a, 'b) a as 'c; b : 'b; .. >
    constraint 'b = < a : 'a; as_b : ('a, 'b) b; .. >
    method as_a : 'c
    method b : 'b
  end
and ['a, 'b] b =
  object
    constraint 'a = < as_a : ('a, 'b) a; b : 'b; .. >
    constraint 'b = < a : 'a; as_b : ('a, 'b) b; .. >
    method a : 'a
    method as_b : ('a, 'b) b
  end
class type ['a] ca =
  object ('b)
    constraint 'a = < a : 'b; as_b : ('b, 'a) b; .. >
    method as_a : ('b, 'a) a
    method b : 'a
  end
class type ['a] cb =
  object ('b)
    constraint 'a = < as_a : ('a, 'b) a; b : 'b; .. >
    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:
  let f () = object method private n = 1 method m = {<>}#n end;;
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 15: the following private methods were made public implicitly:
 n.
val f : unit -> < m : int; n : int > = <fun>
# Characters 11-56:
  let f () = object (self:c) method n = 1 method m = 2 end;;
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This object is expected to have type c but actually has type
         < m : int; n : 'a >
       The first object type has no method n
# Characters 11-69:
  let f () = object (_:'s) constraint 's = < n : int > method m = 1 end;;
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This object is expected to have type < n : int > but actually has type
         < m : 'a >
       The second object type has no method n
#         Characters 66-124:
      object (self: 's) method x = 3 method private m = self end
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This object is expected to have type < x : int; .. >
       but actually has type < x : int >
       Self type cannot be unified with a closed object type
#         val o : < x : int > = <obj>
#         Characters 76-77:
    (x : <m : 'a. 'a * (<m:'b. 'a * <m:'c. 'c * 'bar> > as 'bar) >);;
     ^
Error: This expression has type < m : 'a. 'a * < m : 'a * 'b > > as 'b
       but an expression was expected of type
         < m : 'a. 'a * (< m : 'a * < m : 'c. 'c * 'd > > as 'd) >
       Types for method m are incompatible
#         Characters 176-177:
  let f (x : foo') = (x : bar');;
                      ^
Error: This expression has type foo' = < m : 'a. 'a * 'a foo >
       but an expression was expected of type bar' = < m : 'a. 'a * 'a bar >
       Type 'a foo = < m : 'a * 'a foo > is not compatible with type
         'a bar = < m : 'a * < m : 'c. 'c * 'a bar > > 
       Type 'a foo = < m : 'a * 'a foo > is not compatible with type
         < m : 'c. 'c * 'a bar > 
       Types for method m are incompatible
#     Characters 67-68:
    (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);;
     ^
Error: This expression has type
         < m : 'b. 'b * ('b * < m : 'c. 'c * 'a > as 'a) >
       but an expression was expected of type
         < m : 'b. 'b * ('b * < m : 'c. 'c * ('c * 'd) >) > as 'd
       Types for method m are incompatible
#   Characters 66-67:
    (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);;
     ^
Error: This expression has type
         < m : 'b. 'b * ('b * < m : 'c. 'c * 'a > as 'a) >
       but an expression was expected of type
         < m : 'b. 'b * ('b * < m : 'c. 'c * ('b * 'd) >) > as 'd
       Types for method m are incompatible
#   Characters 51-52:
    (x : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);;
     ^
Error: This expression has type < m : 'b. 'b * ('b * 'a) > as 'a
       but an expression was expected of type
         < m : 'b. 'b * ('b * < m : 'c. 'c * 'd > as 'd) >
       Types for method m are incompatible
#     Characters 14-115:
  ....(x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)>
         :> <m : 'a. 'a -> ('a * 'foo)> as 'foo)..
Error: Type < m : 'a. 'a -> ('a * (< m : 'c. 'c -> 'b as 'e > as 'd) as 'b) >
       is not a subtype of < m : 'a. 'a -> ('a * 'f as 'h) as 'g > as 'f 
#       Characters 88-150:
  = struct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end;;
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
       ...
       Values do not match:
         val f : (< m : 'a. 'a * ('a * 'b) > as 'b) -> unit
       is not included in
         val f : < m : 'b. 'b * ('b * < m : 'c. 'c * 'a > as 'a) > -> unit
#     Characters 78-132:
  = struct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end;;
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
       Modules do not match:
         sig type t = < m : 'a. 'a * ('a * 'b) > as 'b end
       is not included in
         sig type t = < m : 'b. 'b * ('b * < m : 'c. 'c * 'a > as 'a) > end
       Type declarations do not match:
         type t = < m : 'a. 'a * ('a * 'b) > as 'b
       is not included in
         type t = < m : 'b. 'b * ('b * < m : 'c. 'c * 'a > as 'a) >
#     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 : 'a. 'a -> (< m : 'a. 'a -> 'c * <  > > as 'c) * < .. >; .. > as 'b) ->
  'b -> bool = <fun>
#         type t = [ `A | `B ]
# type v = private [> t ]
# - : t -> v = <fun>
# type u = private [< t ]
# - : u -> v = <fun>
# Characters 9-21:
  fun x -> (x : v :> u);;
           ^^^^^^^^^^^^
Error: Type v = [> `A | `B ] is not a subtype of u = [< `A | `B ] 
# type v = private [< t ]
# Characters 9-21:
  fun x -> (x : u :> v);;
           ^^^^^^^^^^^^
Error: Type u = [< `A | `B ] is not a subtype of v = [< `A | `B ] 
# type p = < x : p >
# type q = private < x : p; .. >
# - : q -> p = <fun>
# Characters 9-21:
  fun x -> (x : p :> q);;
           ^^^^^^^^^^^^
Error: Type p = < x : p > is not a subtype of q = < x : p; .. > 
#       Characters 14-100:
  ..(x : <m:'a. (<p:int;..> as 'a) -> int>
      :> <m:'b. (<p:int;q:int;..> as 'b) -> int>)..
Error: Type < m : 'a. (< p : int; .. > as 'a) -> int > is not a subtype of
         < m : 'b. (< p : int; q : int; .. > as 'b) -> int > 
#     val f2 :
  < m : 'a. (< p : < a : int >; .. > as 'a) -> int > ->
  < m : 'b. (< p : < a : int; b : int >; .. > as 'b) -> int > = <fun>
#     Characters 13-107:
  ..(x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int>
      :> <m:'b. (<p:<a:int>;..> as 'b) -> int>)..
Error: Type < m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int >
       is not a subtype of < m : 'b. (< p : < a : int >; .. > as 'b) -> int > 
# Characters 11-55:
  let f4 x = (x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>);;
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Type < p : < a : int; b : int >; .. > is not a subtype of
         < p : < a : int >; .. > 
The second object type has no method b
#   val f5 :
  < m : 'a. [< `A of < p : int > ] as 'a > ->
  < m : 'b. [< `A of <  > ] as 'b > = <fun>
#   Characters 13-83:
    (x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>);;
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Type < m : 'a. [< `A of <  > ] as 'a > is not a subtype of
         < m : 'b. [< `A of < p : int > ] as 'b > 
#     val f : < m : 'a. 'a -> 'a > -> < m : 'a. 'a -> 'a > = <fun>
# - : < m : 'a. 'a -> 'a > -> 'b -> 'b = <fun>
# val f : < m : 'a. 'a -> 'a > * 'b -> < m : 'a. 'a -> 'a > = <fun>
# - : < m : 'a. 'a -> 'a > -> 'b -> 'b = <fun>
# val f : < m : 'a. 'a -> 'a > -> < m : 'a. 'a -> 'a > array = <fun>
# - : < m : 'a. 'a -> 'a > -> 'b -> 'b = <fun>
#     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>
#     type 'a u = c option
# val just : 'a option -> 'a = <fun>
# val f : c -> 'a -> 'a = <fun>
#       val f : 'a -> int = <fun>
val g : 'a -> int = <fun>
# type 'a t = Leaf of 'a | Node of ('a * 'a) t
#   val depth : 'a t -> int = <fun>
#     Characters 34-74:
    function Leaf _ -> 1 | Node x -> 1 + d x
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This definition has type 'a t -> int which is less general than
         'a0. 'a0 t -> int
#   Characters 34-78:
    function Leaf x -> x | Node x -> 1 + depth x;; (* fails *)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This definition has type int t -> int which is less general than
         'a. 'a t -> int
#   Characters 34-74:
    function Leaf x -> x | Node x -> depth x;; (* fails *)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This definition has type 'a t -> 'a which is less general than
         'a0. 'a0 t -> 'a
#   Characters 38-78:
    function Leaf x -> x | Node x -> depth x;; (* fails *)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This definition has type 'b. 'b t -> 'b which is less general than
         'b 'a. 'a t -> 'b
#   val r : 'a list * '_b list ref = ([], {contents = []})
val q : unit -> 'a list * '_b list ref = <fun>
# val f : 'a -> 'a = <fun>
# val zero : [> `B of 'a | `Int of int ] as 'a = `Int 0
# Characters 39-45:
  let zero : 'a. [< `Int of int] as 'a = `Int 0;; (* fails *)
                                         ^^^^^^
Error: This expression has type [> `Int of int ]
       but an expression was expected of type [< `Int of int ]
       Types for tag `Int are incompatible
#       type t = { f : 'a. [> `B of 'a | `Int of int ] as 'a; }
val zero : t = {f = `Int 0}
#   Characters 56-62:
  let zero = {f = `Int 0} ;; (* fails *)
                  ^^^^^^
Error: This expression has type [> `Int of int ]
       but an expression was expected of type [< `Int of int ]
       Types for tag `Int are incompatible
#       val id : 'a -> 'a = <fun>
val neg : int -> bool -> int * bool = <fun>
#                         type t = A of int | B of (int * t) list | C of (string * t) list
val transf : (int -> t) -> t -> t = <fun>
val transf_alist : (int -> t) -> ('a * t) list -> ('a * t) list = <fun>
#         type t = { f : 'a. ('a list -> int) Lazy.t; }
val l : t = {f = <lazy>}
#     type t = { f : 'a. 'a -> unit; }
# - : t = {f = <fun>}
# Characters 19-20:
  let f ?x y = y in {f};; (* fail *)
                     ^
Error: This field value has type unit -> unit which is less general than
         'a. 'a -> unit
#               module Polux :
  sig
    type 'par t = 'par
    val ident : 'a -> 'a
    class alias : object method alias : 'a t -> 'a end
    val f : < m : 'a. 'a t > -> < m : 'a. 'a >
  end
#       Exception: Pervasives.Exit.
#   Exception: Pervasives.Exit.
#   Exception: Pervasives.Exit.
#       Characters 20-44:
  type 'x t = < f : 'y. 'y t >;;
      ^^^^^^^^^^^^^^^^^^^^^^^^
Error: In the definition of t, type 'y t should be 'x t
# 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.