- Notifications
You must be signed in to change notification settings - Fork4.2k
Support init accessor in CSharpSyntaxFacts#48137
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
...paces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…rvices/SyntaxFacts/CSharpSyntaxFacts.cs
...paces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
...paces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
davidwengier left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This change makes sense, but I don't see too much value in aggressively updating all of these APIs without known consuming use cases, or tests (or both!).
Youssef1313 commentedSep 29, 2020
@davidwengier I looked at the usages of one of these changes, and it ends up being used for the public API SyntaxGenerator.WithAccessibility. It may not be needed internally for roslyncurrently. But consumers of this API should get the desired behavior. I haven't confirmed whether the other change ends up being used in a public API or not. |
CyrusNajmabadi commentedSep 29, 2020
THis is a testable scenario :) Plz add test. |
davidwengier commentedSep 29, 2020
I don't disagree, but there could also be issues if things light up in areas that they were never intended to, or otherwise don't support. Hopefully, of course, the existing test coverage validates that :) |
Youssef1313 commentedSep 29, 2020
@davidwengier Got it. Let me check what tests will fail in#48158 and update these tests for init accessor in this PR. |
| caseSyntaxKind.PropertyDeclaration: | ||
| caseSyntaxKind.GetAccessorDeclaration: | ||
| caseSyntaxKind.SetAccessorDeclaration: | ||
| caseSyntaxKind.InitAccessorDeclaration: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@davidwengier I removed both GetAccessorDeclaration and InitAccessorDeclaration in a draft. There are no test failures. So the current tests, unfortunately, doesn't cover those.
The usages that depend on this method are in:
- CodeLens\CodeLensReferencesService.cs (there is a call to
syntaxFactsService.IsDeclaration(node)) - CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (there is a call to
.DescendantNodes(n => !syntaxFacts.IsDeclaration(n)))
Unlike the other change, I'm not able to guess the effect of this change.
I'll try to change the method to onlyreturn false in the draft in a hope to see test failures (i.e. other switch arms are tested).
| caseSyntaxKind.PropertyDeclaration: | ||
| caseSyntaxKind.GetAccessorDeclaration: | ||
| caseSyntaxKind.SetAccessorDeclaration: | ||
| caseSyntaxKind.InitAccessorDeclaration: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think it's a good idea to update this one without knowing the change it introduce.
Thiswhole method isn't covered in the tests. See how#48158 is green.
...paces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Youssef1313 commentedOct 7, 2020
@CyrusNajmabadi@davidwengier Is this ready to merge? |
Uh oh!
There was an error while loading.Please reload this page.
Prefer squash/merge.