Fix S1854 FP: Raises when variable is assigned in expression that is part of ternary condition
Closed this issue · 1 comments
mary-georgiou-sonarsource commented
Repro steps
void Repro(bool condition)
{
byte[]? tempArray = null;
_ = condition
? tempArray = new byte[42] // Noncompliant FP
: new byte[24];
if (tempArray != null)
{
Console.WriteLine(tempArray);
}
}
sebastien-marichal commented
This is the same root cause as #9472.