-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
Area-CompilersFeature - Nullable Reference TypesNullable Reference TypesNullable Reference Typeshelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it
Milestone
Description
Version Used: 9.0.205
Steps to Reproduce:
Compile a file a file containing
byte? b = 1;
b -= 1;
.NET Lab link: https://lab.razor.fyi/#41Li4gooyk8vSszVSy4WEkmqLEm1V0hSsFUwtOZKUtAF0V5MycVRnByXPn05NTldgCWBsYIRAA
Diagnostic Id:
Nullability of reference types in value of type 'int?' doesn't match target type 'byte?'.CS8619
Expected Behavior:
No warning, since subtracting 1 from a nullable byte is fine.
Actual Behavior:
CS8619 warning appears.
Note: Even if somehow there should be a warning since -= should never be used with byte? types, there still is a bug here in that the warning message is incorrect, since the nullablility of int? does match the nullability of byte?.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersFeature - Nullable Reference TypesNullable Reference TypesNullable Reference Typeshelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it