-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-CompilersFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesRegression
Milestone
Description
Version Used:
Microsoft.Net.Compilers 3.9.0
Steps to Reproduce:
#nullable enable
class C<T> where T : notnull
{
void M(T initial, System.Func<T, T?> selector)
{
// ⚠ CS8600 Converting null literal or possible null value to non-nullable type.
// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
for (var current = initial; current != null; current = selector(current))
{
}
}
}Expected Behavior:
No CS8600 warning
Actual Behavior:
CS8600 warning
Notes:
This code snippet previous compiled without warning on 3.8.0, so this appears to be a regression. It also only happens with the constraint T : notnull. T : class for example does not give the warning
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesRegression