Repository navigation
C#: Data flow for implicit deconstruct calls. - #22861
Draft
michaelnebel wants to merge 5 commits into
Draft
michaelnebel wants to merge 5 commits into
michaelnebel wants to merge 5 commits into
Conversation
michaelnebel
force-pushed
the
csharp/deconstruct
branch
2 times, most recently
from
October 22, 2026 10:00
46fe603 to
adf869e
Compare
michaelnebel
force-pushed
the
csharp/deconstruct
branch
4 times, most recently
from
October 22, 2026 13:15
e275353 to
393c574
Compare
…ct calls and add data flow steps.
michaelnebel
force-pushed
the
csharp/deconstruct
branch
from
October 22, 2026 13:53
393c574 to
315dce5
Compare
Comment on lines
+1919
to
+1925
| /** | ||
| * Holds, if there is an implicit call to the to the `deconstruct` method at `source`, where `target` is the expression | ||
| * receiving the deconstructed values, and `tt` is the tuple type of the `target` expression. | ||
| * The method may be declared on the source type or inherited from a base class. | ||
| * | ||
| * Example: `var (x, y) = r;` where `r` is of type `R` with a `Deconstruct` method. | ||
| */ |
This branch has not been deployed
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.
In this PR we introduce data flow support for implicit deconstruct calls.
The example below is valid C# syntax and the assignment
var (x, y) = rimplicitly invokes the compiler generated Deconstruct method onr.The last assignment is equivalent to
The QL implementation contains the following
Furthermore, there is also the following limitations
Note, that value tuples don't have a deconstruct method and the tuple classes have deconstruct extension methods. If we want replace the existing tuple logic, we need to support deconstruct extension methods and support nested deconstructs.