-
Notifications
You must be signed in to change notification settings - Fork 4k
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
public enum DeclarationKind must have an InitAccessor member #48136
Comments
Why not just use |
@sharwell Did you mean that SyntaxGenerator.GetDeclarationKind(SyntaxNode) method should return "DeclarationKind.SetAccessor" for both set and init declarations? |
Also, SyntaxGenerator currently have GetSetAccessorStatements, and GetGetAccessorStatements. A new method GetInitAccessorStatements should be considered. |
Isn't an |
@sharwell Yes, it's even compiled to |
Yes. And my understanding is that that's how the compiler is exposing this info. |
I'm okay if you agree that both should fall into DeclarationKind.SetAccessor. I'll open a PR |
I could end up going either way. I can see advantages and disadvantages to both approaches. |
Does this method need to account for init as well? roslyn/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs Lines 2535 to 2539 in 06c4312
I think it currently doesn't. I can put that in #48137 as well |
i think it's challenign to answer some of these without having clear cases of where consumers use this so we can judge what their expectations would be . |
@CyrusNajmabadi Is this discussable in a design meeting? or the issue needs to get some comments from consumers to decide? |
We would likely need comments from consumers here. |
DeclarationKind enum now contains "RecordClass" member, which is kind of syntactic sugar of a "class" with extra synthesized members. Given that, I think it makes sense to do that with "init" vs "set" since it's a similar case. @sharwell @CyrusNajmabadi What are your thoughts? |
Also note that Lines 2047 to 2057 in 90ff6db
|
This seems unfortunate. Do we know when it was added? Edit: It looks like it shipped in 16.9. I'm not sure we need to make the rest of |
Hmmm, from the discussion in #10094, it seems that you're indeed correct. "RecordClass" shouldn't have been added at all. But removing it is a breaking change :/ Now the question is:
|
It might not be to late to mark |
@sharwell Should I open a PR or wait until other team members agree? |
You could open a draft PR to frame the discussion |
https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.editing.declarationkind?view=roslyn-dotnet
The current enum members include GetAccessor, SetAccessor, but not InitAccessor.
The text was updated successfully, but these errors were encountered: