-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
Area-CompilersBugFeature - Pattern MatchingPattern MatchingPattern MatchinguntriagedIssues and PRs which have not yet been triaged by a leadIssues and PRs which have not yet been triaged by a lead
Milestone
Description
Version Used: C#12
Steps to Reproduce:
- compile the sample code or test it in sharplab
#pragma warning disable CS8524
enum MyEnum { A }
class C
{
void M()
{
bool? b = null;
_ = b switch // <= correctly warns about missing null arm with CS8655
{
true => 1,
false => 2,
};
MyEnum? x = null;
_ = x switch // <= does NOT warn about missing null arm with CS8655
{
MyEnum.A => "A",
};
}
}
Diagnostic Id: CS8655: The switch expression does not handle some null inputs (it is not exhaustive).
If this is a report about a bug in an analyzer, please include the diagnostic ID and message if possible (e.g. "IDE0030: Use coalesce expression").
Expected Behavior: nullable enum-variable switch-expression with missing null should yield CS8655
Actual Behavior: nullable enum-variable switch-expression with missing null does NOT yield CS8655
Metadata
Metadata
Assignees
Labels
Area-CompilersBugFeature - Pattern MatchingPattern MatchingPattern MatchinguntriagedIssues and PRs which have not yet been triaged by a leadIssues and PRs which have not yet been triaged by a lead