Skip to content

Commit

Permalink
Record-structs: don't offer to complete destructor (#52408)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv authored Apr 4, 2021
1 parent 1ea41c7 commit 57091b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7482,13 +7482,12 @@ struct C
{
~$$
}";
await VerifyItemExistsAsync(markup, "C");
await VerifyItemIsAbsentAsync(markup, "C");
}

[Theory, Trait(Traits.Feature, Traits.Features.Completion)]
[InlineData("record")]
[InlineData("record class")]
[InlineData("record struct")]
public async Task RecordDestructor(string record)
{
var markup = $@"
Expand All @@ -7499,6 +7498,17 @@ public async Task RecordDestructor(string record)
await VerifyItemExistsAsync(markup, "C");
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task RecordStructDestructor()
{
var markup = $@"
record struct C
{{
~$$
}}";
await VerifyItemIsAbsentAsync(markup, "C");
}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task FieldAvailableInBothLinkedFiles()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private static CSharpSyntaxContext CreateContextWorker(Workspace? workspace, Sem

var isDestructorTypeContext = targetToken.IsKind(SyntaxKind.TildeToken) &&
targetToken.Parent.IsKind(SyntaxKind.DestructorDeclaration) &&
targetToken.Parent.Parent.IsKind(SyntaxKind.ClassDeclaration, SyntaxKind.StructDeclaration, SyntaxKind.RecordDeclaration, SyntaxKind.RecordStructDeclaration);
targetToken.Parent.Parent.IsKind(SyntaxKind.ClassDeclaration, SyntaxKind.RecordDeclaration);

// Typing a dot after a numeric expression (numericExpression.)
// - maybe a start of MemberAccessExpression like numericExpression.Member.
Expand Down

0 comments on commit 57091b1

Please sign in to comment.