From f0000f4a012865fa7c043ae8cd3466378cd72365 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Tue, 14 Aug 2018 10:43:59 +0200 Subject: [PATCH] fix #685 - Useless final attribute detects false positives --- src/dscanner/analysis/final_attribute.d | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/dscanner/analysis/final_attribute.d b/src/dscanner/analysis/final_attribute.d index e52fc90..7616aa7 100644 --- a/src/dscanner/analysis/final_attribute.d +++ b/src/dscanner/analysis/final_attribute.d @@ -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."); }