Skip to content

Comments

Support tuple unpacking in dictionary comprehensions in eldritch-core#1576

Merged
KCarretto merged 1 commit intomainfrom
dictionary-comprehension-tuple-unpacking-4124653622789545699
Jan 15, 2026
Merged

Support tuple unpacking in dictionary comprehensions in eldritch-core#1576
KCarretto merged 1 commit intomainfrom
dictionary-comprehension-tuple-unpacking-4124653622789545699

Conversation

@google-labs-jules
Copy link
Contributor

Implemented tuple unpacking for comprehensions (dict, list, set) in eldritch-core.
This allows syntax like {k: v for k, v in items}.
Changes involve:

  • Updating AST to support multiple loop variables.
  • Updating Parser to parse comma-separated loop variables.
  • Updating Evaluator to unpack items into variables.
  • Adding comprehensive tests.

PR created automatically by Jules for task 4124653622789545699 started by @KCarretto

…n eldritch-core.

Updated `ast.rs` to store multiple loop variables `vars` instead of a single `var` in `ExprKind` variants.
Updated `parser/expr.rs` to parse multiple loop variables in comprehensions.
Updated `interpreter/operations/comprehension.rs` to handle tuple unpacking logic.
Added test cases in `tests/comprehensions_unpacking.rs`.
@google-labs-jules
Copy link
Contributor Author

👋 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.

@KCarretto KCarretto marked this pull request as ready for review January 15, 2026 15:51
@KCarretto KCarretto requested review from hulto and nullmonk January 15, 2026 15:51
@KCarretto KCarretto enabled auto-merge January 15, 2026 15:52
@github-actions
Copy link
Contributor

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
3053    ±0 3053    ±0 0    ±0 0    ±0 0    ±0 0    ±0 1ms    ±0

Previous Results

Build 🏗️ Result 🧪 Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
#486 3053 3053 0 0 0 0 29.9s

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
3053 0 0 6.9s

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
eldritch: file::temp_file_impl::tests::test_temp_file_r_name 3 2.3s 6.9s
eldritch: file::temp_file_impl::tests::test_temp_file_r_name 3 2.3s 6.9s
eldritch: file::temp_file_impl::tests::test_temp_file_r_name 3 2.3s 6.9s
eldritch: file::template_impl::tests::test_template_basic 3 2.4s 6.9s
eldritch: file::template_impl::tests::test_template_basic 3 2.4s 6.9s
eldritch: file::template_impl::tests::test_template_basic 3 2.4s 6.9s
eldritch: file::temp_file_impl::tests::test_temp_file_w_name 3 2.3s 6.9s
eldritch: file::temp_file_impl::tests::test_temp_file_w_name 3 2.3s 6.9s
eldritch: file::temp_file_impl::tests::test_temp_file_w_name 3 2.3s 6.9s
eldritch: file::template_impl::tests::test_template_build_context 3 2.3s 6.9s

🎉 No failed tests in this run. | 🍂 No flaky tests in this run.

Github Test Reporter by CTRF 💚

Copy link
Collaborator

@nullmonk nullmonk left a comment

Choose a reason for hiding this comment

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

Tested with this:

s = {1,2,3}
print([y+10 for y in s])

d = {
    "x": 1,
    "y": 2,
    "z": 3,
}
print({k: v for k,v in d.items()})

l = [
    ("x", 1),
    ("y", 2),
    ("z", 3),
]
print({x: y+10 for x,y in l})

Everything looks good

@KCarretto KCarretto added this pull request to the merge queue Jan 15, 2026
Merged via the queue into main with commit b2cf545 Jan 15, 2026
8 checks passed
@KCarretto KCarretto deleted the dictionary-comprehension-tuple-unpacking-4124653622789545699 branch January 15, 2026 20:46
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