Skip to content

Support abstract methods and records in complete statement command#48128

Merged
sharwell merged 12 commits intodotnet:mainfrom
Youssef1313:patch-17
Apr 8, 2021
Merged

Support abstract methods and records in complete statement command#48128
sharwell merged 12 commits intodotnet:mainfrom
Youssef1313:patch-17

Conversation

@Youssef1313
Copy link
Member

No description provided.

@Youssef1313 Youssef1313 requested a review from a team as a code owner September 28, 2020 22:10
@Youssef1313 Youssef1313 marked this pull request as draft September 28, 2020 22:26
@jinujoseph jinujoseph added Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. labels Sep 29, 2020
@Youssef1313 Youssef1313 marked this pull request as ready for review October 1, 2020 13:21
@Youssef1313 Youssef1313 changed the title Add tests for simple positional record in complete statement command Support abstract methods and records in complete statement command Oct 2, 2020
[InlineData("abstract void M(object o = $$default(object))", "abstract void M(object o = default(object))")]
[InlineData("public record C(int X, $$int Y)", "public record C(int X, int Y)")]
[InlineData("public record C(int X, int$$ Y)", "public record C(int X, int Y)")]
[InlineData("public record C(int X, int Y$$)", "public record C(int X, int Y)")]
Copy link
Contributor

Choose a reason for hiding this comment

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

i see tests added for records, but nothing new for the 'abstract method' code you added. do we need tests for that?

Copy link
Member Author

Choose a reason for hiding this comment

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

@CyrusNajmabadi Abstract methods already have tests. But the test was disabled. I added record tests (in addition to the existing for abstract methods), and enabled the test.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok!

@CyrusNajmabadi CyrusNajmabadi marked this pull request as draft November 9, 2020 19:14
@Youssef1313
Copy link
Member Author

@CyrusNajmabadi I'm going to re-mark this as ready for review as the tests are already there.

@Youssef1313 Youssef1313 marked this pull request as ready for review November 9, 2020 21:25
@Youssef1313
Copy link
Member Author

@CyrusNajmabadi Is this ready for merge?

@Youssef1313
Copy link
Member Author

@CyrusNajmabadi Is this ready if CI passes?

@Youssef1313 Youssef1313 mentioned this pull request Feb 18, 2021
92 tasks

if (currentNode is MethodDeclarationSyntax method &&
(method.Modifiers.Any(SyntaxKind.AbstractKeyword) || method.Modifiers.Any(SyntaxKind.ExternKeyword) ||
method.IsParentKind(SyntaxKind.InterfaceDeclaration)))
Copy link
Contributor

Choose a reason for hiding this comment

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

this statements is too complex to me.

Copy link
Contributor

@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.

can you simplify this a bit. mixing &&'s and ||s is too confusing to me.

Base automatically changed from master to main March 3, 2021 23:52
@Youssef1313
Copy link
Member Author

@CyrusNajmabadi Anything left?

Comment on lines +220 to +221
if (method.Modifiers.Any(SyntaxKind.AbstractKeyword) || method.Modifiers.Any(SyntaxKind.ExternKeyword) ||
method.IsParentKind(SyntaxKind.InterfaceDeclaration))
Copy link
Contributor

Choose a reason for hiding this comment

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

❔ Is there any harm in making this unconditional?

Copy link
Contributor

Choose a reason for hiding this comment

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

📝 Note that partial methods also can be declared without a body.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sharwell I think it will unnecessarily move the caret to the end for typos, which can be annoying.

Copy link
Member Author

Choose a reason for hiding this comment

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

📝 Note that partial methods also can be declared without a body.

That's a good case. Going to fix it and add a test.

Copy link
Contributor

@sharwell sharwell left a comment

Choose a reason for hiding this comment

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

No objection to the current expansion, but I think we should make the behavior unconditional for methods.

@Youssef1313
Copy link
Member Author

@sharwell It this ready to merge?

@sharwell sharwell enabled auto-merge April 8, 2021 01:22
Copy link
Contributor

@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.

thanks!

@sharwell sharwell merged commit 9853099 into dotnet:main Apr 8, 2021
@ghost ghost added this to the Next milestone Apr 8, 2021
@Youssef1313 Youssef1313 deleted the patch-17 branch April 8, 2021 02:55
@dibarbet dibarbet modified the milestones: Next, 16.10.P3 Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants