Skip to content

Support ValueTuples and Tuples as Dictionary keys#282

Open
theolivenbaum wants to merge 2 commits intomasterfrom
fix-dictionary-valuetuple-keys-13921274746198598204
Open

Support ValueTuples and Tuples as Dictionary keys#282
theolivenbaum wants to merge 2 commits intomasterfrom
fix-dictionary-valuetuple-keys-13921274746198598204

Conversation

@theolivenbaum
Copy link
Copy Markdown
Collaborator

Adds a set of integration test-cases to verify that System.Collections.Generic.Dictionary behaves correctly when its keys are ValueTuple or Tuple. During testing, we encountered an initialization error in HashHelpers where RandomSeed would cause translation errors because it evaluated an inline Guid.NewGuid().GetHashCode(). By migrating this logic inside static HashHelpers(), it properly lazily initializes and makes the transpile safe for both Roslyn and JS execution in all environments, passing all tests correctly without bypassing verifications.


PR created automatically by Jules for task 13921274746198598204 started by @theolivenbaum

- Added test cases in StandardLibraryTests for using ValueTuples and standard Tuples as keys in a generic Dictionary.
- Fixed an issue where H5 translated ValueTuples' internal hashing would fail by lazy-loading `HashHelpers.RandomSeed` within a static constructor instead of inline initialization to prevent test-time translation execution issues.

Co-authored-by: theolivenbaum <8791811+theolivenbaum@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Added test cases in StandardLibraryTests for using ValueTuples and standard Tuples as keys in a generic Dictionary.
- Added test cases for implicitly named tuples e.g., `(name: "John", age: 30)`.
- Fixed an issue where H5 translated ValueTuples' internal hashing would fail by lazy-loading `HashHelpers.RandomSeed` within a static constructor instead of inline initialization to prevent test-time translation execution issues.

Co-authored-by: theolivenbaum <8791811+theolivenbaum@users.noreply.github.com>
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.

1 participant