fix unused variable check for unitthreaded checks

such as `a.should == b`
This commit is contained in:
WebFreak001 2023-07-17 12:09:29 +02:00 committed by Jan Jurzitza
parent c8262f4220
commit a958f9ac7b
2 changed files with 13 additions and 0 deletions

View File

@ -79,6 +79,13 @@ abstract class UnusedIdentifierCheck : BaseAnalyzer
mixin PartsUseVariables!ThrowExpression; mixin PartsUseVariables!ThrowExpression;
mixin PartsUseVariables!CastExpression; mixin PartsUseVariables!CastExpression;
override void dynamicDispatch(const ExpressionNode n)
{
interestDepth++;
super.dynamicDispatch(n);
interestDepth--;
}
override void visit(const SwitchStatement switchStatement) override void visit(const SwitchStatement switchStatement)
{ {
if (switchStatement.expression !is null) if (switchStatement.expression !is null)

View File

@ -125,6 +125,12 @@ final class UnusedVariableCheck : UnusedStorageCheck
__traits(isPOD); __traits(isPOD);
} }
void unitthreaded()
{
auto testVar = foo.sort!myComp;
genVar.should == testVar;
}
}c, sac); }c, sac);
stderr.writeln("Unittest for UnusedVariableCheck passed."); stderr.writeln("Unittest for UnusedVariableCheck passed.");
} }