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
{{ message }}
Repository navigation
Internal typechecker error triggered by a constraint on self type in a class type #7711
Original bug ID: 7711 Reporter:@Octachron Assigned to:@garrigue Status: resolved (set by @garrigue on 2018-01-30T07:09:55Z) Resolution: fixed Priority: normal Severity: minor Version: 4.07.0+dev/beta2/rc1/rc2 Fixed in version: 4.07.0+dev/beta2/rc1/rc2 Category: typing Monitored by:@nojb@gasche
Bug description
The following code fails (on ? — 4.02.3 — trunk) with a failed assertion in Ctype.object_fields:
type 'a r = <w: int -> int; .. > as 'a
class type virtual ct = object('self)
constraint 'self = 'not_self r
end
Note also that the snippet above compiles fine if 'not_self is replaced by 'self, if the type constructor r is inlined, or if ct is made a virtual class.
That's a bad one.
I think it's been there since the very beginning of ocaml:
functions all over the place seem to assume that the signature of a class is an object type, never an abbreviation, but nothing prevents from unifying it with an abbreviation.
I see no easy solution short of changing the type of csig_self to something safer.
The simplest change would be to use type_desc rather than type_expr.
Activity
vicuna commentedon Jan 23, 2018
Comment author: @garrigue
That's a bad one.
I think it's been there since the very beginning of ocaml:
functions all over the place seem to assume that the signature of a class is an object type, never an abbreviation, but nothing prevents from unifying it with an abbreviation.
I see no easy solution short of changing the type of csig_self to something safer.
The simplest change would be to use type_desc rather than type_expr.
vicuna commentedon Jan 24, 2018
Comment author: @garrigue
Tentative fix: #1581
Not so clean as it adds cruft to unify3, but I see no other easy way.
vicuna commentedon Jan 30, 2018
Comment author: @garrigue
Fixed by commit 54225b5 in trunk.