Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address feedback
  • Loading branch information
Youssef1313 committed Jan 27, 2022
commit 38ac4f0a83033161da4a18b5a83e4723db30a8ab
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.

using System.Threading.Tasks;
using Test.Utilities;
using Xunit;
using VerifyCS = Test.Utilities.CSharpCodeFixVerifier<
Microsoft.NetCore.CSharp.Analyzers.Runtime.CSharpDetectPreviewFeatureAnalyzer,
Expand Down Expand Up @@ -164,7 +165,7 @@ public abstract {type} AbClass
await test.RunAsync();
}

[Fact]
[Fact, WorkItem(5802, "https://github.com/dotnet/roslyn-analyzers/issues/5802")]
public async Task TestPartialClassWithFirstDeclarationNotHavingBaseTypes()
{
var test = TestCS(@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,47 +126,15 @@ Namespace Microsoft.NetCore.VisualBasic.Analyzers.Runtime

For Each syntaxReference In typeSymbolDeclaringReferences
Dim typeSymbolDefinition = syntaxReference.GetSyntax()
Dim classStatement = TryCast(typeSymbolDefinition, ClassStatementSyntax)
If classStatement IsNot Nothing Then
Dim classBlock = TryCast(classStatement.Parent, ClassBlockSyntax)
If classBlock IsNot Nothing Then
Dim typeStatement = TryCast(typeSymbolDefinition, TypeStatementSyntax)
If typeStatement IsNot Nothing Then
Dim typeBlock = TryCast(typeStatement.Parent, TypeBlockSyntax)
If typeBlock IsNot Nothing Then
Dim syntaxNode As SyntaxNode = Nothing
If TryGetPreviewInterfaceNodeForClassOrStructImplementingPreviewInterface(classBlock.Inherits, previewInterfaceSymbol, syntaxNode) Then
If TryGetPreviewInterfaceNodeForClassOrStructImplementingPreviewInterface(typeBlock.Inherits, previewInterfaceSymbol, syntaxNode) Then
Return syntaxNode
Else
If TryGetPreviewInterfaceNodeForClassOrStructImplementingPreviewInterface(classBlock.Implements, previewInterfaceSymbol, syntaxNode) Then
Return syntaxNode
End If
End If
End If
End If

Dim structStatement = TryCast(typeSymbolDefinition, StructureStatementSyntax)
If structStatement IsNot Nothing Then
Dim structBlock = TryCast(structStatement.Parent, StructureBlockSyntax)
If structBlock IsNot Nothing Then
Dim syntaxNode As SyntaxNode = Nothing
If TryGetPreviewInterfaceNodeForClassOrStructImplementingPreviewInterface(structBlock.Inherits, previewInterfaceSymbol, syntaxNode) Then
Return syntaxNode
Else
If TryGetPreviewInterfaceNodeForClassOrStructImplementingPreviewInterface(structBlock.Implements, previewInterfaceSymbol, syntaxNode) Then
Return syntaxNode
End If
End If
End If
End If

Dim interfaceStatement = TryCast(typeSymbolDefinition, InterfaceStatementSyntax)
If interfaceStatement IsNot Nothing Then
Dim interfaceBlock = TryCast(interfaceStatement.Parent, InterfaceBlockSyntax)
If interfaceBlock IsNot Nothing Then
Dim syntaxNode As SyntaxNode = Nothing
If TryGetPreviewInterfaceNodeForClassOrStructImplementingPreviewInterface(interfaceBlock.Implements, previewInterfaceSymbol, syntaxNode) Then
ElseIf TryGetPreviewInterfaceNodeForClassOrStructImplementingPreviewInterface(typeBlock.Implements, previewInterfaceSymbol, syntaxNode) Then
Return syntaxNode
Else
If TryGetPreviewInterfaceNodeForClassOrStructImplementingPreviewInterface(interfaceBlock.Inherits, previewInterfaceSymbol, syntaxNode) Then
Return syntaxNode
End If
End If
End If
End If
Expand Down