Fixed collection and object initializer usage analysis not working in top-level code#61584
Fixed collection and object initializer usage analysis not working in top-level code#61584CyrusNajmabadi merged 6 commits intodotnet:mainfrom DoctorKrolic:initializers-in-top-level-code
Conversation
|
You need to set the output type of the test project to be a consoleapp, not a dll. |
|
@CyrusNajmabadi Thanks, tests are now done. PR is ready for review |
|
Can someone review this PR? Thanks in advance |
...paces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs
Outdated
Show resolved
Hide resolved
...paces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ISyntaxFacts.cs
Outdated
Show resolved
Hide resolved
|
Done with pass. |
src/Analyzers/Core/Analyzers/UseObjectInitializer/UseNamedMemberInitializerAnalyzer.cs
Outdated
Show resolved
Hide resolved
...edUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxFacts.vb
Outdated
Show resolved
Hide resolved
src/Analyzers/Core/Analyzers/UseObjectInitializer/UseNamedMemberInitializerAnalyzer.cs
Outdated
Show resolved
Hide resolved
|
Done with pass. Only a couple of things to tweak :) |
|
Awesome, thanks! |
|
@CyrusNajmabadi Approve?) |
|
Yup yup. Thanks :-) |
|
It's such a shame that global statements have a wrapper node around each individual statement rather than having something like |
|
Fully argree. But I guess it's our life now( Changing this behaviour into something better is too massive breaking change to be made. |
|
We have no cases of an empty nice that is only a wrapper around a SyntaxList. That itself would be an abnormality in the roslyn syntax model. This upholds the invariant that all nodes have at least one node or token as a direct child. |
Fixes: #61066
Need help with tests here. Tried to add this test for object initializers:
... and got

CS8805compiler error for some reason: