You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code below should report an NI1017 error but does not because it is in the last section of a ternary operator. Errors in the first value of ternarys are reported correctly.
The code below should report an NI1017 error but does not because it is in the last section of a ternary operator. Errors in the first value of ternarys are reported correctly.
private static IEnumerable Ternary(IEnumerable numbers)
{
return numbers is null
? Enumerable.Empty()
: numbers.Where(n => n < 10).Select(n => $"{n}");
}
Likewise violations in a return statement are not reported. If you assign to a local then return the local, the error is reported.
private static int Expression(IEnumerable numbers)
{
return numbers.Where(n => n < 10).Select(n => n * 2).Max();
}
The text was updated successfully, but these errors were encountered: