Skip to content

Commit 252a525

Browse files
committed
Correcting incorrect suppression in example code.
Correcting incorrect suppression in example code.
1 parent 344f875 commit 252a525

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

ExhaustiveMatching.Examples/.editorconfig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@
55
# EM0001: Switch on Enum Not Exhaustive
66
dotnet_diagnostic.EM0001.severity = suggestion
77

8-
# EM0002: Switch on Closed Type Not Exhaustive
8+
# EM0002: Switch on Nullable Enum Type Not Exhaustive
99
dotnet_diagnostic.EM0002.severity = suggestion
10+
11+
# EM0003: Switch on Closed Type Not Exhaustive
12+
dotnet_diagnostic.EM0003.severity = suggestion
13+
14+
# EM0101: Case Pattern Not Supported
15+
#dotnet_diagnostic.EM0101.severity = suggestion

ExhaustiveMatching.Examples/ReadMe/CoinFlipExample.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public enum CoinFlip { Heads = 1, Tails }
1717
public static void Example(CoinFlip coinFlip)
1818
{
1919
#region snippet
20+
// EM0001: Switch on Enum Not Exhaustive
2021
// ERROR Enum value not handled by switch: Tails
2122
switch (coinFlip)
2223
{
@@ -27,11 +28,12 @@ public static void Example(CoinFlip coinFlip)
2728
break;
2829
}
2930

31+
// EM0001: Switch on Enum Not Exhaustive
3032
// ERROR Enum value not handled by switch: Tails
3133
_ = coinFlip switch
3234
{
3335
CoinFlip.Heads => "Heads!",
34-
_ => throw ExhaustiveMatch.Failed(coinFlip),
36+
_ => throw ExhaustiveMatch.Failed(coinFlip),
3537
};
3638
#endregion
3739
}

ExhaustiveMatching.Examples/ReadMe/DayOfWeekExample.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public static class DayOfWeekExample
1010
public static void Example(DayOfWeek dayOfWeek)
1111
{
1212
#region snippet
13+
// EM0001: Switch on Enum Not Exhaustive
1314
// ERROR Enum value not handled by switch: Sunday
1415
switch (dayOfWeek)
1516
{

ExhaustiveMatching.Examples/ReadMe/IPAddressExample.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class IPv6Address : IPAddress { /* … */ }
1919
public static IPv6Address Example(IPAddress ipAddress)
2020
{
2121
#region snippet
22+
// EM0003: Switch on Closed Type Not Exhaustive
2223
// ERROR Subtype not handled by switch: IPv6Address
2324
switch (ipAddress)
2425
{

0 commit comments

Comments
 (0)