From 62297fdf7b7075d73e72650567a17571362ddaac Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Tue, 31 Jan 2023 23:29:25 -0800 Subject: [PATCH 1/2] Include aliasName in resolveSymbol --- src/dscanner/analysis/mismatched_args.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dscanner/analysis/mismatched_args.d b/src/dscanner/analysis/mismatched_args.d index a25ce0e..0507113 100644 --- a/src/dscanner/analysis/mismatched_args.d +++ b/src/dscanner/analysis/mismatched_args.d @@ -161,7 +161,8 @@ const(DSymbol)*[] resolveSymbol(const Scope* sc, const istring[] symbolChain) { if (symbol.kind == CompletionKind.variableName || symbol.kind == CompletionKind.memberVariableName - || symbol.kind == CompletionKind.functionName) + || symbol.kind == CompletionKind.functionName + || symbol.kind == CompletionKind.aliasName) symbol = symbol.type; if (symbol is null) { From 3437e30cac4e46ec4cf62673b508b2616e14b189 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Tue, 31 Jan 2023 23:32:52 -0800 Subject: [PATCH 2/2] Add unit test --- src/dscanner/analysis/unused_result.d | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/dscanner/analysis/unused_result.d b/src/dscanner/analysis/unused_result.d index 85f34a4..3977e15 100644 --- a/src/dscanner/analysis/unused_result.d +++ b/src/dscanner/analysis/unused_result.d @@ -132,6 +132,21 @@ unittest } }c.format(UnusedResultChecker.MSG), sac); + assertAnalyzerWarnings(q{ + struct Foo + { + static bool get() + { + return false; + } + } + alias Bar = Foo; + void main() + { + Bar.get(); // [warn]: %s + } + }c.format(UnusedResultChecker.MSG), sac); + assertAnalyzerWarnings(q{ void main() {