Skip to content

Type checking of type members invariance is broken #374

@potanin

Description

@potanin

The attached code compiles when it should not. The commented out line:

setCell(PointB, cell2d)

gives the appropriat error:

The callee method cannot accept actual arguments with types: 'Point3D, Cell[Point2D]; expected types __generic__T.T, Cell[__generic__T.T]' at location file test.wyv on line 41 column 1

But we also expect this error on this line:

setCell(pointA, cell3d)

Which compiles even with explicit [Point2D] annotation:

setCell[Point2D](pointA, cell3d)

It appears the type member subtype check for bounds is the cause of this so invariance cannot be enforced. A final proper fix would be to implement the full decidable type checking of type members form Julian's PhD thesis of course!

Rename this file back to .wyv as GitBug blocks it:

test.wyv.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions