-
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
Improve GTD & simplification of anonymous type properties #5786
Conversation
Tagging @dotnet/roslyn-ide for review (with specific @DustinCampbell callout 😄) |
return rewrittenNode; | ||
} | ||
|
||
return rewrittenNode.WithNameEquals(SyntaxFactory.NameEquals(implicitPropertyName).WithAdditionalAnnotations(Simplifier.Annotation, Formatter.Annotation)); |
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.
total nit: Maybe break this onto two lines (placing SyntaxFactory.NameEquals on its own line) to make it clearer what the target of WithAdditionalAnnotations
is?
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.
Introducing a local for this.
👍 |
fcb72ee
to
4086cdc
Compare
Fixed up @DustinCampbell's nits, but leaving the SymbolFinder API aspect open for further discussion. |
Fixes dotnet#3589 Consider the anonymous type: ```C# var x = new { A.z } ``` There are two main changes here: - SymbolFinder.FindSymbolAtPosition now prefers "A.z" over "<anonymous type>.z" when looking up symbols at "z" in the above code. Consumers of this API will now get a consistent result between the case of "z" in "{ A.z }" and the case of "z" in "{ t = A.z }". **Note**: This is a behavioral change of a public API. - Add simplifier expansion and reduction handling of implicitly named anonymous type property declarators. A declarator such as that in "new { A.z }" is expanded to "new { A = A.z }", any relevant code fixes are performed, and then the "A = " is removed if the expression on the right is of the right kind (identifier or member access) and would cause the property to be named "A".
4086cdc
to
1a5fee4
Compare
I'm not really arguing against us having a good 'simple' method that does the right thing most of the time for most clients. :) I think all i'm saying is that sometimes that 'simple' method is insufficient, and just leads us into the situation we're in now where features are broken in extremely subtle and hard to realize ways. It seems (to me at least), that we need to:
Thanks! |
retest this please |
Be sure to update breaking change document if we go ahead with this. |
retest vsi please |
Changing title to test something. |
We suspect your merge conflicts are causing the vsi failures because closed is out of sync with open, resolve them and retry. |
@dpoeschl Is this still needed? The target issue was closed recently. |
Nope. Thanks. |
Fixes #3589
Consider the anonymous type defined here:
There are two main changes: