diff --git a/src/dscanner/analysis/auto_function.d b/src/dscanner/analysis/auto_function.d index 25bb1bb..53aeac0 100644 --- a/src/dscanner/analysis/auto_function.d +++ b/src/dscanner/analysis/auto_function.d @@ -49,7 +49,7 @@ public: _returns[$-1] = false; const bool autoFun = decl.storageClasses - .any!(a => a.token.type == tok!"auto"); + .any!(a => a.token.type == tok!"auto" || a.atAttribute !is null); decl.accept(this); @@ -216,6 +216,16 @@ unittest AutoFunctionChecker.MESSAGE, ), sac); + assertAnalyzerWarnings(q{ + @property doStuff(){} // [warn]: %s + @safe doStuff(){} // [warn]: %s + @disable doStuff(); + @safe void doStuff(); + }c.format( + AutoFunctionChecker.MESSAGE, + AutoFunctionChecker.MESSAGE, + ), sac); + assertAnalyzerWarnings(q{ enum _genSave = "return true;"; auto doStuff(){ mixin(_genSave);}