Skip to content

Internal typechecker error triggered by a constraint on self type in a class type #7711

Closed

Description

@vicuna

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.

Activity

  1. vicuna commented on Jan 23, 2018

    @vicuna
    Author

    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.

  2. vicuna commented on Jan 24, 2018

    @vicuna
    Author

    Comment author: @garrigue

    Tentative fix: #1581

    Not so clean as it adds cruft to unify3, but I see no other easy way.

  3. vicuna commented on Jan 30, 2018

    @vicuna
    Author

    Comment author: @garrigue

    Fixed by commit 54225b5 in trunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions