Skip to content

Fix cross module constants and comprehension scoping#526

Merged
Al-Kindi-0 merged 6 commits intonextfrom
al-fix-cross-module-constants-and-comprehension-scoping
Feb 2, 2026
Merged

Fix cross module constants and comprehension scoping#526
Al-Kindi-0 merged 6 commits intonextfrom
al-fix-cross-module-constants-and-comprehension-scoping

Conversation

@Al-Kindi-0
Copy link
Copy Markdown
Collaborator

Describe your changes

This PR fixes two bugs related to cross-module imports and comprehension scoping:

  1. Cross-module constant dependencies:
    Constants used in comprehension iterables fail when imported across module boundaries.

  2. Comprehension periodic binding scoping:
    Iterating over a vector containing periodic column references causes the binding to be mistyped as PeriodicColumn, leading to "no entry found for key" panic.

Checklist before requesting a review

  • Repo forked and branch created from next according to naming convention.
  • Commit messages and codestyle follow conventions.
  • Commits are signed.
  • Relevant issues are linked in the PR description.
  • Tests added for new functionality.
  • Documentation/comments updated according to changes.
  • Updated CHANGELOG.md

@Al-Kindi-0 Al-Kindi-0 changed the title Al fix cross module constants and comprehension scoping Fix cross module constants and comprehension scoping Dec 23, 2025
@Soulthym Soulthym self-requested a review January 14, 2026 13:49
Copy link
Copy Markdown
Collaborator

@Soulthym Soulthym left a comment

Choose a reason for hiding this comment

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

Hey @Al-Kindi-0, I left a few comments below about clarifications and a minor nit regarding Boxing RangeExpr. The code itself looks good to me otherwise, great job!

let current_item_node_index = self.get_node_index_or_add(&current_item);
for (referenced_item, ref_type) in self.referenced.clone().iter() {
let referenced_item_node_index = self.get_node_index_or_add(referenced_item);
self.deps_graph.add_edge(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm assuming this is the part of the issue you encountered, we were overriding values without checking for their existence first?

This edit looks correct, just asking to confirm I understand the problem properly

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, we were calling add_node unconditionally, which could create duplicate nodes. get_node_index_or_add reuses the existing node index.

Default,
/// Access binds a sub-slice of a vector
Slice(RangeExpr),
Slice(Box<RangeExpr>),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a reason to switching to a Box here instead of an owned RangeExpr?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Slice(Box<RangeExpr>) is there mainly to avoid the clippy::large_enum_variant warning.

Copy link
Copy Markdown
Collaborator

@Leo-Besancon Leo-Besancon left a comment

Choose a reason for hiding this comment

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

Nice catches, thank you!
LGTM, I was wondering if the fix for the bindings from PeriodicColumn to local variable could have any impact but I don't see how, and if the tests don't catch regressions it's probably good!

@Al-Kindi-0 Al-Kindi-0 merged commit 16ff83f into next Feb 2, 2026
11 checks passed
@Al-Kindi-0 Al-Kindi-0 deleted the al-fix-cross-module-constants-and-comprehension-scoping branch February 2, 2026 06:45
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.

3 participants