fix #685 - Useless final attribute detects false positives

This commit is contained in:
Basile Burg 2018-08-14 10:43:59 +02:00
parent 3a859d39c4
commit f0000f4a01
1 changed files with 11 additions and 0 deletions

View File

@ -149,12 +149,14 @@ public:
undoBlockStatic = true;
}
const bool wasFinalAggr = _finalAggregate;
scope(exit)
{
d.accept(this);
_parent = savedParent;
if (undoBlockStatic)
_blockStatic = false;
_finalAggregate = wasFinalAggr;
}
if (!d.attributeDeclaration &&
@ -402,5 +404,14 @@ public:
FinalAttributeChecker.MSGB.format(FinalAttributeChecker.MESSAGE.class_s)
), sac);
assertAnalyzerWarnings(q{
class Statement
{
final class UsesEH{}
final void comeFrom(){}
}
}, sac);
stderr.writeln("Unittest for FinalAttributeChecker passed.");
}