Proper support for tuples with 8 or more elements#76
Open
koenbeuk wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
Enhances the Roslyn source generator’s tuple == / != emission so that tuple equality is evaluated across all elements for tuples with 8+ elements (i.e., ValueTuple<T1..T7, TRest> nesting), and adds both snapshot and runtime tests to validate the behavior.
Changes:
- Update
ExpressionTreeEmitter.EmitTupleBinaryto iterate tuple elements via Roslyn’sTupleElementsand correctly access nestedRestchains for 8+ element tuples. - Add a new generator snapshot test for 8-element tuple equality output.
- Add runtime tests proving expanded expressions correctly compare the 8th and 15th elements, and a regression test around polymorphic dispatch scanning.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/TupleTests.TupleBinary_Equality_8Elements.verified.txt | New snapshot baseline demonstrating generated element-wise equality including Rest traversal for the 8th element. |
| tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/TupleTests.cs | Adds a snapshot test covering A == B for 8-element tuples. |
| tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/GeneratedExpressionRuntimeTests.cs | Adds runtime proof tests ensuring expanded expressions compare all tuple elements (8 and 15), plus a polymorphic dispatch regression scenario. |
| src/ExpressiveSharp.Generator/Emitter/ExpressionTreeEmitter.cs | Fixes tuple binary emission to support 8+ elements by traversing nested Rest tuples and comparing every element. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Enhance tuple equality comparison to support tuples containing 8 or more elements, ensuring accurate comparisons across all elements. Add corresponding unit tests to validate this functionality.