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

Record-structs: validate and fix a number of IDE tests #52261

Merged
merged 9 commits into from
Apr 2, 2021

Conversation

jcouv
Copy link
Member

@jcouv jcouv commented Mar 30, 2021

Test plan #51199

@jcouv jcouv added this to the C# 10 milestone Mar 30, 2021
@jcouv jcouv self-assigned this Mar 30, 2021
@jcouv jcouv marked this pull request as ready for review March 30, 2021 23:05
@jcouv jcouv requested review from a team as code owners March 30, 2021 23:05
{
~$$
}";
await VerifyItemExistsAsync(markup, "C");
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi Mar 31, 2021

Choose a reason for hiding this comment

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

interesting :) #Resolved

Comment on lines 87 to 89
await TestAsync(content, body, testHost, w => new FirstDocIsActiveAndVisibleDocumentTrackingService(w.Workspace));

async Task TestAsync(
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi Mar 31, 2021

Choose a reason for hiding this comment

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

Suggested change
await TestAsync(content, body, testHost, w => new FirstDocIsActiveAndVisibleDocumentTrackingService(w.Workspace));
async Task TestAsync(
await TestAsync(content, body, testHost, w => new FirstDocIsActiveAndVisibleDocumentTrackingService(w.Workspace));
return;
async Task TestAsync(

IDE style is to have an explicit exit point before the local funtions to make it clear that no actual method code follows htem. #Resolved

@@ -105,42 +106,42 @@ internal enum DeclaredSymbolInfoKind : byte
Span = span;
InheritanceNames = inheritanceNames;

const uint MaxFlagValue = 0b1111;
const uint MaxFlagValue = 0b10000;
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi Mar 31, 2021

Choose a reason for hiding this comment

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

because you're chaning the format here, need to rev teh version number in SyntaxTreeIndex.SerializationFormatChecksum. That way we don't read out persisted data from a previous version that odesn't match our current format. #Resolved

Copy link
Member

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

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

lgtm, except needing to rev our persistence versin.

}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task RecordStructDestructor()
Copy link
Member

@sharwell sharwell Mar 31, 2021

Choose a reason for hiding this comment

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

💡 This set of 3 tests should be combined into a single [Theory] with the following data:

[InlineData("record")]
[InlineData("record class")]
[InlineData("record struct")]
``` #Resolved

}

[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task TreatRecordClassPositionalParameterAsProperty()
Copy link
Member

@sharwell sharwell Mar 31, 2021

Choose a reason for hiding this comment

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

💡 This set of three tests should be combined into a single [Theory] to ensure all three are covered in a consistent and relatable manner. #Resolved

@jcouv
Copy link
Member Author

jcouv commented Mar 31, 2021

@sharwell @CyrusNajmabadi Addressed your feedback. Thanks

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

Changes under Compilers LGTM (commit 9)

@jcouv jcouv enabled auto-merge (squash) April 2, 2021 22:31
@jcouv jcouv merged commit 1ea41c7 into dotnet:features/record-structs Apr 2, 2021
@jcouv jcouv deleted the rs-symbol8 branch April 3, 2021 00:53
@jcouv jcouv mentioned this pull request Apr 3, 2021
92 tasks
Comment on lines +104 to +105
// VisualStudio.Language.NavigateTo.Interfaces.NavigateToItemKind doesn't have a record struct, fall back to struct.
// This should be updated whenever NavigateToItemKind has a record struct.
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to route this to the appropriate team?

Not sure if it's the editor team who owns this?

cc: @jinujoseph @olegtk

@@ -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);
targetToken.Parent.Parent.IsKind(SyntaxKind.ClassDeclaration, SyntaxKind.StructDeclaration, SyntaxKind.RecordDeclaration, SyntaxKind.RecordStructDeclaration);
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why StructDeclaration existed here. Both RecordStructDeclaration and StructDelaration seems wrong here. They cannot contain a destructor. Anything I'm missing @jcouv?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. Destructors are not allowed in structs or record structs. I'll revert this.

Copy link
Member Author

Choose a reason for hiding this comment

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

PR for fix: #52408
Will have to confirm with IDE folks on expected behavior since the previous behavior for structs seems intentional (had a bug attached)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants