Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address a few locations also need to care about partial properties #73792

Conversation

@Cosifne Cosifne requested a review from a team as a code owner May 30, 2024 22:34
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels May 30, 2024
@@ -164,6 +164,34 @@ public partial class C1
Assert.Equal(implementation, ResolveSymbol(implementation, comp, SymbolKeyComparison.None));
}

[Fact]
public void ExtendedPartialPropertyDefinitionAndImplementationResolveCorrectly()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a test verified the same behavior as partial methods above.

@@ -73,18 +73,27 @@ public CSharpNavigationBarItemService()
continue;
}

var method = member as IMethodSymbol;
if (method != null && method.PartialImplementationPart != null)
if (member is IMethodSymbol { PartialImplementationPart: { } } methodSymbol)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, navigation bar still works.
Before:
image

After:
image

After behavior matches the existing behavior of partial method.

@@ -227,8 +227,12 @@ private async Task<IEnumerable<INamedTypeSymbol>> GetAllTypesAsync(CancellationT
return namespaces.GetAllTypes(cancellationToken);
}

private static IMethodSymbol GetPartialImplementationPartOrNull(ISymbol symbol)
=> (symbol.Kind == SymbolKind.Method) ? ((IMethodSymbol)symbol).PartialImplementationPart : null;
private static ISymbol GetPartialImplementationPartOrNull(ISymbol symbol) => symbol.Kind switch
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @tmat to take a look. Not familiar with debugger, but I feel this change brings no harm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants