Skip to content

Proper support for tuples with 8 or more elements#76

Open
koenbeuk wants to merge 1 commit into
mainfrom
fix/large-tuples
Open

Proper support for tuples with 8 or more elements#76
koenbeuk wants to merge 1 commit into
mainfrom
fix/large-tuples

Conversation

@koenbeuk

Copy link
Copy Markdown
Collaborator

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.

Copilot AI review requested due to automatic review settings July 26, 2026 00:26
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...veSharp.Generator/Emitter/ExpressionTreeEmitter.cs 97.14% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.EmitTupleBinary to iterate tuple elements via Roslyn’s TupleElements and correctly access nested Rest chains 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants