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: 151 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
class x ?(p = 1) () =
object method m = new x ~p:2 () end
Error: "The expression "new x" has type ?p:int -> unit -> x but is used with
type
int -> unit -> 'a"
This looks very strange, and I think it is a bug.
This is again due to the the non-principality of the typing of optionals.
That is, in 3.00 the type information for the constructor is not available
inside
the class, only after it has been defined.
I admit this can be disturbing, since for "let rec" definitions special
processing
is done in order to provide such type information.
I added such preprocessing for classes too, and your example now compiles
correctly.
Original bug ID: 151
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Gerd Stolpmann
Version: 3.00
OS: Linux
Submission from: p3e9c36a8.dip0.t-ipconnect.de (62.156.54.168)
Hi,
this does not work (classical mode):
class x ?(p = 1) () =
object
val v = p
end
Error: "The expression "new x" has type ?p:int -> unit -> x but is used with
type
int -> unit -> 'a"
new x ~p:2 () from outside the class works (if I comment m out).
If I change the method m to:
it works again, too.
This looks very strange, and I think it is a bug.
The text was updated successfully, but these errors were encountered: