Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F# 9.0 Invalid sample for struct discriminated unions #44428

Open
gewarren opened this issue Jan 18, 2025 · 1 comment
Open

F# 9.0 Invalid sample for struct discriminated unions #44428

gewarren opened this issue Jan 18, 2025 · 1 comment
Labels
⌚ Not Triaged Not triaged

Comments

@gewarren
Copy link
Contributor

gewarren commented Jan 18, 2025


Issue moved from MicrosoftDocs/feedback#4042


From @ryanovic on Monday, January 6, 2025 2:17:34 PM

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


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@gewarren
Copy link
Contributor Author


Issue moved from MicrosoftDocs/feedback#4042


From @WELCOME[bot] on Monday, January 6, 2025 2:17:38 PM

Thank you for opening an issue! One of our team members will get back to you with additional information.

If this is a product issue, please close this issue and contact the product's support instead. For a list of support websites, see Support for Microsoft products and apps.

@dotnet-policy-service dotnet-policy-service bot added the ⌚ Not Triaged Not triaged label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌚ Not Triaged Not triaged
Projects
None yet
Development

No branches or pull requests

1 participant