-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Puzzling error message with free type variables #7565
Copy link
Copy link
Closed
Labels
Description
Original bug ID: 7565
Reporter: @sbriais
Assigned to: @Octachron
Status: resolved (set by @Octachron on 2018-11-24T20:10:04Z)
Resolution: fixed
Priority: low
Severity: feature
Fixed in version: 4.08.0+dev/beta1/beta2
Category: typing
Child of: #7338
Monitored by: @gasche
Bug description
Consider the following code:
class type t_a =
object
method f: 'a. 'a -> int
end
let f (o:t_a) = o # f 0
let () =
let o =
object
method f _ = 0
end
in
f o
We got the following error message:
Error: This expression has type < f : 'a -> int >
but an expression was expected of type t_a
The universal variable 'a0 would escape its scope
The error message is puzzling because there is no 'a0 in the inferred type.
Reactions are currently unavailable