You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1967 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Damien Pous
Version: 3.07+6 (2003-11-25)
OS: Debian/GNU Linux
Submission from: mailhost.ens-lsh.fr (193.51.131.2)
Using polymorphic variants, the following function `k' is given a polymorphic
type :
let a = function `A -> 5 | _ -> 0;;
let k ?(g = a) () = g `A;;
val k : ?g:([> `A ] -> int) -> unit -> int =
let b = function A -> 6 | B -> 7 | _ -> 0;;
let _ = k ~g:b ();;
: int = 6
But not when doing the same thing with objects :
let a = object method a = 5 end;;
let k ?(g = a) () = g#a;;
val k : ?g:< a : int > -> unit -> int =
let b = object method a = 6 method b = 7 end;;
let _ = k ~g:b ();;
This expression has type < a : int; b : int > but is here used with type < a :
int >
(that's the same using classes)
The text was updated successfully, but these errors were encountered:
Original bug ID: 1967
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Damien Pous
Version: 3.07+6 (2003-11-25)
OS: Debian/GNU Linux
Submission from: mailhost.ens-lsh.fr (193.51.131.2)
Using polymorphic variants, the following function `k' is given a polymorphic
type :
let a = function `A -> 5 | _ -> 0;;
let k ?(g = a) () = g `A;;
val k : ?g:([> `A ] -> int) -> unit -> int =
let b = function
A -> 6 |
B -> 7 | _ -> 0;;let _ = k ~g:b ();;
But not when doing the same thing with objects :
let a = object method a = 5 end;;
let k ?(g = a) () = g#a;;
val k : ?g:< a : int > -> unit -> int =
let b = object method a = 6 method b = 7 end;;
let _ = k ~g:b ();;
This expression has type < a : int; b : int > but is here used with type < a :
int >
(that's the same using classes)
The text was updated successfully, but these errors were encountered: