Skip to content

Commit

Permalink
Merge pull request #668 from BBasile/issue-665
Browse files Browse the repository at this point in the history
fix #665 - The check for auto function without return doesn't handle "implicit auto functions"
  • Loading branch information
wilzbach authored Jun 20, 2018
2 parents 2a565a8 + af25256 commit 103a327
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/dscanner/analysis/auto_function.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);}
Expand Down

0 comments on commit 103a327

Please sign in to comment.