Skip to content

You should not be able to cast to a private record/variant #8457

Description

@tsnobip

Today, this compiles without any warning or error (cf playground):

module Foo = {
  type t = private {foo: int}
}

module Bar = {
  type t = {...Foo.t}
}

let bar = {Bar.foo: 9}
let foo = (bar :> Foo.t)

which doesn't make sense because private records/variants are precisely meant to avoid instantiation.

This should IMO at least raise a warning.

Activity

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

Metadata

Metadata

Assignees

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