GoToDef on deconstruction assignment and foreach#25984
Merged
jcouv merged 1 commit intodotnet:masterfrom Apr 6, 2018
Merged
Conversation
jcouv
commented
Apr 6, 2018
| return GetSymbolInfo(semanticModel, node, token, cancellationToken).GetBestOrAllSymbols(); | ||
| } | ||
|
|
||
| private SymbolInfo GetSymbolInfo(SemanticModel semanticModel, SyntaxNode node, SyntaxToken token, CancellationToken cancellationToken) |
Member
Author
There was a problem hiding this comment.
📝 The constructors for SymbolInfo are internal to the compiler (inaccessible from this code), so I couldn't just add the new logic to the GetSymbolInfo method.
| switch (node) | ||
| { | ||
| case AssignmentExpressionSyntax assignment when token.Kind() == SyntaxKind.EqualsToken: | ||
| return GetDeconstructionAssignmentMethods(semanticModel, node).As<ISymbol>(); |
Contributor
There was a problem hiding this comment.
should we be doing something similar in VB?
Member
Author
There was a problem hiding this comment.
There is no deconstruction in VB yet
mavasani
approved these changes
Apr 6, 2018
Member
Author
|
test windows_release_unit64_prtest please |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR associates the symbols for various
Deconstructmethods involved in a deconstruction with the=(in deconstruction assignment or deconstruction declaration) or theinsyntax (in deconstruction foreach).Note that GoToDef currently assumes that there is only one symbol that is "the definition". I think we should relax that, as a later change. If we did, we could not only list the
Deconstructmethods, but also theGetEnumeratormethod, and even conversion operators involved in the assignment or foreach.In the meantime, GoToDef only goes to the first
Deconstructmethod listed, which is the top-level one. That is good enough for most cases (nested deconstructions would be less common).Fixes #16529
Fixes #24413
Tagging @CyrusNajmabadi FYI