Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

F# 9.0 Invalid sample for struct discriminated unions #4042

@ryanovic

Description

@ryanovic

In the language reference document(Discriminated Unions) provided the following F# code example:

[<Struct>]
type Multicase =
    | Case1 of string
    | Case2 of int
    | Case3 of double

Which is not correct, and would not compile with the recent .net9 SDK(error FS3585: If a multicase union type is a struct, then all fields with the same name must be of the same type). According to the other article(What's new in F# 9) only fields which have the same name and type, can share the same memory location, so it will not work for string / int / double intersection.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions