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: 1377 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Hi,
While ICFPing, I came upon some strange typing error messages.
The first one is :
class type ct = object
method m : l:int -> ct
end
let rec f (o : ct) =
let rec g o =
let x = o#m 1 in
g x in
g o
which is well typed accorded to caml if I remove the l label. Here is
the error I got:
This expression has type ct = < m : l:int -> ct > as 'a
but is here used with type 'a
The second one is ill-typed and get the same error message:
class type ct = object
method m : l:int -> int
end
let rec f (o : ct) =
let rec g o =
let x = o#m 1 in
g x in
g o
If I remove the label I got a stranger error:
This expression has type ct = < m : int -> int > as 'a
but is here used with type 'a
Type int is not compatible with type ct = 'a
Can someone explain that?
--
Dimitri Ara
The text was updated successfully, but these errors were encountered:
Thanks for you report.
This is now fixed in the CVS version:
Objective Caml version 3.06+1 (2002-09-07)
class type ct = object
method m : l:int -> int
end
let rec f (o : ct) =
let rec g o =
let x = o#m 1 in
g x in
g o;;
^
This expression has type ct = < m : l:int -> int > but is here used with type
< m : int -> 'a; .. > as 'a
Note that this code is semantically correct: you just need to add a type
annotation in g to make it typable.
Original bug ID: 1377
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hi,
While ICFPing, I came upon some strange typing error messages.
The first one is :
class type ct = object
method m : l:int -> ct
end
let rec f (o : ct) =
let rec g o =
let x = o#m 1 in
g x in
g o
which is well typed accorded to caml if I remove the l label. Here is
the error I got:
This expression has type ct = < m : l:int -> ct > as 'a
but is here used with type 'a
The second one is ill-typed and get the same error message:
class type ct = object
method m : l:int -> int
end
let rec f (o : ct) =
let rec g o =
let x = o#m 1 in
g x in
g o
If I remove the label I got a stranger error:
This expression has type ct = < m : int -> int > as 'a
but is here used with type 'a
Type int is not compatible with type ct = 'a
Can someone explain that?
--
Dimitri Ara
The text was updated successfully, but these errors were encountered: