add tests for shortened function body extensions
Remove implementation in unused label (expressions can't have labels)
This commit is contained in:
parent
a3fe7611a8
commit
631791e14d
|
@ -126,6 +126,22 @@ unittest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct InfiniteRange
|
||||||
|
{
|
||||||
|
bool empty() => false; // [warn]: %1$s
|
||||||
|
bool stuff() => false;
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://issues.dlang.org/show_bug.cgi?id=18409
|
||||||
|
struct Foo
|
||||||
|
{
|
||||||
|
~this() nothrow @nogc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool empty() { return false; }
|
bool empty() { return false; }
|
||||||
class C { bool empty() { return false; } } // [warn]: %1$s
|
class C { bool empty() { return false; } } // [warn]: %1$s
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,8 @@ final class ProperlyDocumentedPublicFunctions : BaseAnalyzer
|
||||||
import std.array : Appender;
|
import std.array : Appender;
|
||||||
|
|
||||||
// ignore header declaration for now
|
// ignore header declaration for now
|
||||||
if (!decl.functionBody || !decl.functionBody.specifiedFunctionBody)
|
if (!decl.functionBody || (!decl.functionBody.specifiedFunctionBody
|
||||||
|
&& !decl.functionBody.shortenedFunctionBody))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (nestedFuncs == 1)
|
if (nestedFuncs == 1)
|
||||||
|
@ -659,6 +660,20 @@ int foo(int k){} // [warn]: %s
|
||||||
|
|
||||||
assertAnalyzerWarnings(q{
|
assertAnalyzerWarnings(q{
|
||||||
/**
|
/**
|
||||||
|
* Description.
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* A long description.
|
||||||
|
*/
|
||||||
|
int foo(int k) => k; // [warn]: %s
|
||||||
|
}c.format(
|
||||||
|
ProperlyDocumentedPublicFunctions.MISSING_PARAMS_MESSAGE.format("k")
|
||||||
|
), sac);
|
||||||
|
|
||||||
|
assertAnalyzerWarnings(q{
|
||||||
|
/**
|
||||||
Description.
|
Description.
|
||||||
|
|
||||||
Params:
|
Params:
|
||||||
|
|
|
@ -53,8 +53,6 @@ final class UnusedLabelCheck : BaseAnalyzer
|
||||||
}
|
}
|
||||||
if (functionBody.missingFunctionBody && functionBody.missingFunctionBody.functionContracts)
|
if (functionBody.missingFunctionBody && functionBody.missingFunctionBody.functionContracts)
|
||||||
functionBody.missingFunctionBody.functionContracts.each!((a){pushScope(); a.accept(this); popScope();});
|
functionBody.missingFunctionBody.functionContracts.each!((a){pushScope(); a.accept(this); popScope();});
|
||||||
if (functionBody.specifiedFunctionBody && functionBody.specifiedFunctionBody.functionContracts)
|
|
||||||
functionBody.specifiedFunctionBody.functionContracts.each!((a){pushScope(); a.accept(this); popScope();});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override void visit(const LabeledStatement labeledStatement)
|
override void visit(const LabeledStatement labeledStatement)
|
||||||
|
|
Loading…
Reference in New Issue