Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #51 from JarLob/enum
Browse files Browse the repository at this point in the history
HAA0102 false positive fixed
  • Loading branch information
Mukul Sabharwal authored Nov 10, 2018
2 parents db50c67 + c8ef476 commit 8911358
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ public void CallSiteImplicitAllocation_DoNotReportNonOverriddenMethodCallForStat
var analyser = new CallSiteImplicitAllocationAnalyzer();
var info = ProcessCode(analyser, snippet, ImmutableArray.Create(SyntaxKind.InvocationExpression));

Assert.AreEqual(0, info.Allocations.Count);
}

[TestMethod]
public void CallSiteImplicitAllocation_DoNotReportNonOverriddenMethodCallForNonVirtualCalls() {
var snippet = @"
using System.IO;
FileAttributes attr = FileAttributes.System;
attr.HasFlag (FileAttributes.Directory);
";

var analyser = new CallSiteImplicitAllocationAnalyzer();
var info = ProcessCode(analyser, snippet, ImmutableArray.Create(SyntaxKind.InvocationExpression));

Assert.AreEqual(0, info.Allocations.Count);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected override void AnalyzeNode(SyntaxNodeAnalysisContext context)

if (semanticModel.GetSymbolInfo(invocationExpression, cancellationToken).Symbol is IMethodSymbol methodInfo)
{
if (!methodInfo.IsStatic)
if (methodInfo.IsOverride)
{
CheckNonOverridenMethodOnStruct(methodInfo, reportDiagnostic, invocationExpression, filePath);
}
Expand Down

0 comments on commit 8911358

Please sign in to comment.