Merge pull request #615 from BBasile/issue-610
fix #610 - False Negative For Missing Template Param In Ddoc merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
commit
fb76b59c89
|
@ -8,6 +8,7 @@ import dparse.lexer;
|
||||||
import dparse.ast;
|
import dparse.ast;
|
||||||
import dparse.formatter : astFmt = format;
|
import dparse.formatter : astFmt = format;
|
||||||
import dscanner.analysis.base : BaseAnalyzer;
|
import dscanner.analysis.base : BaseAnalyzer;
|
||||||
|
import dscanner.utils : safeAccess;
|
||||||
|
|
||||||
import std.format : format;
|
import std.format : format;
|
||||||
import std.range.primitives;
|
import std.range.primitives;
|
||||||
|
@ -300,11 +301,17 @@ private:
|
||||||
foreach (p; params.parameters)
|
foreach (p; params.parameters)
|
||||||
{
|
{
|
||||||
string templateName;
|
string templateName;
|
||||||
if (const t = p.type)
|
|
||||||
if (const t2 = t.type2)
|
if (auto iot = safeAccess(p).type.type2
|
||||||
if (const tip = t2.typeIdentifierPart)
|
.typeIdentifierPart.identifierOrTemplateInstance.unwrap)
|
||||||
if (const iot = tip.identifierOrTemplateInstance)
|
{
|
||||||
templateName = iot.identifier.text;
|
templateName = iot.identifier.text;
|
||||||
|
}
|
||||||
|
else if (auto iot = safeAccess(p).type.type2.type.type2
|
||||||
|
.typeIdentifierPart.identifierOrTemplateInstance.unwrap)
|
||||||
|
{
|
||||||
|
templateName = iot.identifier.text;
|
||||||
|
}
|
||||||
|
|
||||||
const idx = tlList.countUntil(templateName);
|
const idx = tlList.countUntil(templateName);
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
|
@ -910,6 +917,25 @@ unittest
|
||||||
}, sac);
|
}, sac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
StaticAnalysisConfig sac = disabledConfig;
|
||||||
|
sac.properly_documented_public_functions = Check.enabled;
|
||||||
|
|
||||||
|
assertAnalyzerWarnings(q{
|
||||||
|
/++
|
||||||
|
An awesome description.
|
||||||
|
|
||||||
|
Params:
|
||||||
|
items = things to put.
|
||||||
|
|
||||||
|
Returns: Awesome values.
|
||||||
|
+/
|
||||||
|
void put(Range)(const(Range) items) if (canPutConstRange!Range)
|
||||||
|
{}
|
||||||
|
}, sac);
|
||||||
|
}
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
StaticAnalysisConfig sac = disabledConfig;
|
StaticAnalysisConfig sac = disabledConfig;
|
||||||
|
|
Loading…
Reference in New Issue