Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/fsharp/language-reference/enumerations.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ The default `enum` function works with type `int32`. Therefore, it cannot be use

Additionally, cases for enums are always emitted as `public`. This is so that they align with C# and the rest of the .NET platform.

To enable [exhaustive matching](match-expressions.md) for only the defined enum cases, you can suppress warning FS0104 using the directive `#nowarn "104"`. This allows the compiler to treat only declared enum values as valid during pattern matching, avoiding the need for a catch-all case — useful when you're certain all values are covered.

The warning FS0104 (`Enums may take values outside known cases.`) exists because enums can be assigned arbitrary underlying values, e.g. directly or as a result of [bitwise operations](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/enum#enumeration-types-as-bit-flags)

## See also

- [F# Language Reference](index.md)
Expand Down