fix #665 - The check for auto function without return doesn't handle "implicit auto functions"
This commit is contained in:
parent
76d8a30d23
commit
af252569f7
|
@ -49,7 +49,7 @@ public:
|
||||||
_returns[$-1] = false;
|
_returns[$-1] = false;
|
||||||
|
|
||||||
const bool autoFun = decl.storageClasses
|
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);
|
decl.accept(this);
|
||||||
|
|
||||||
|
@ -216,6 +216,16 @@ unittest
|
||||||
AutoFunctionChecker.MESSAGE,
|
AutoFunctionChecker.MESSAGE,
|
||||||
), sac);
|
), 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{
|
assertAnalyzerWarnings(q{
|
||||||
enum _genSave = "return true;";
|
enum _genSave = "return true;";
|
||||||
auto doStuff(){ mixin(_genSave);}
|
auto doStuff(){ mixin(_genSave);}
|
||||||
|
|
Loading…
Reference in New Issue