Skip to content

ByRefLike structs can be declared in Anonymous Record types #6104

@cartermp

Description

@cartermp

The following compiles:

open System

let f (r: {| S: Span<int> |})=  r.S.Length

f {| S=Span<int>.Empty |}

It should not compile, because r is reference type, thus violating the rules of ByRefLike structs.

Given that we cannot declare a ByRefLike struct anonymous record, ByReflike types such as Span should not be allowed inside of an anonymous record at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions