File: pr3968_bad.compilers.reference

package info (click to toggle)
ocaml 5.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 43,124 kB
  • sloc: ml: 355,439; ansic: 51,636; sh: 25,098; asm: 5,413; makefile: 3,673; python: 919; javascript: 273; awk: 253; perl: 59; fortran: 21; cs: 9
file content (44 lines) | stat: -rw-r--r-- 1,574 bytes parent folder | download
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
File "pr3968_bad.ml", lines 20-29, characters 0-3:
20 | object
21 |   val l = e1
22 |   val r = e2
23 |   method eval env =
24 |       match l with
25 |     | `Abs(var,body) ->
26 |         Hashtbl.add env var r;
27 |         body
28 |     | _ -> `App(l,r);
29 | end
Error: The class type
         object
           val l :
             [ `Abs of string * ([> `App of 'a * exp ] as 'b)
             | `App of expr * expr ] as 'a
           val r : exp
           method eval : (string, exp) Hashtbl.t -> 'b
         end
       is not matched by the class type exp
       The class type
         object
           val l :
             [ `Abs of string * ([> `App of 'a * exp ] as 'b)
             | `App of expr * expr ] as 'a
           val r : exp
           method eval : (string, exp) Hashtbl.t -> 'b
         end
       is not matched by the class type
         object method eval : (string, exp) Hashtbl.t -> expr end
       The method eval has type
         "(string, exp) Hashtbl.t ->
         ([> `App of [ `Abs of string * 'a | `App of expr * expr ] * exp ]
          as 'a)"
       but is expected to have type "(string, exp) Hashtbl.t -> expr"
       Type
         "[> `App of [ `Abs of string * 'a | `App of expr * expr ] * exp ]
         as 'a"
       is not compatible with type
         "expr" = "[ `Abs of string * expr | `App of expr * expr ]"
       Type "exp" = "< eval : (string, exp) Hashtbl.t -> expr >"
       is not compatible with type
         "expr" = "[ `Abs of string * expr | `App of expr * expr ]"
       Types for tag "`App" are incompatible