Skip to content

Commit

Permalink
Merge pull request #3424 from mavasani/Issue3414
Browse files Browse the repository at this point in the history
Handle null base type in CA1710
  • Loading branch information
mavasani committed Mar 24, 2020
2 parents 6dc3658 + 62ca6c9 commit 01850a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private static void AnalyzeCompilationStart(CompilationStartAnalysisContext cont
Debug.Assert(namedTypeSymbol.MatchesConfiguredVisibility(saContext.Options, SpecialCollectionRule, saContext.CancellationToken));
var baseTypes = excludeIndirectBaseTypes
? (new[] { namedTypeSymbol.BaseType })
? namedTypeSymbol.BaseType != null ? ImmutableArray.Create(namedTypeSymbol.BaseType) : ImmutableArray<INamedTypeSymbol>.Empty
: namedTypeSymbol.GetBaseTypes();
if (TryGetTypeSuffix(baseTypes, baseTypeSuffixMap, userTypeSuffixMap, out var typeSuffixInfo))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,15 @@ End Class"
await vbTest.RunAsync();
}

[Fact, WorkItem(3414, "https://github.com/dotnet/roslyn-analyzers/issues/3414")]
public async Task CA1710_Interfaces()
{
await VerifyCS.VerifyAnalyzerAsync(@"
public interface I
{
}");
}

private static DiagnosticResult GetCA1710BasicResultAt(int line, int column, string typeName, string suffix, bool isSpecial = false) =>
VerifyVB.Diagnostic(isSpecial ? IdentifiersShouldHaveCorrectSuffixAnalyzer.SpecialCollectionRule : IdentifiersShouldHaveCorrectSuffixAnalyzer.DefaultRule)
.WithLocation(line, column)
Expand Down

0 comments on commit 01850a4

Please sign in to comment.