Skip to content

Fix import alias resolution - #18

Merged
mstdokumaci merged 1 commit into
mainfrom
bug-fixes
Aug 11, 2026
Merged

mstdokumaci merged 1 commit into
mainfrom
bug-fixes

Conversation

@mstdokumaci

@mstdokumaci mstdokumaci commented Aug 11, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes

    • Improved import detection for address-of expressions and member chains.
    • Unresolved aliases are now excluded from import blocks, while valid aliases remain supported.
    • Import block boundaries are recalculated correctly after alias resolution.
    • Local identifiers are no longer incorrectly treated as imports.
  • Sorting

    • Improved handling of re-exports, public aliases, and address-of import chains.
    • Import sorting is now stable and consistent across standard and bottom-placement modes.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The AST scanner now removes aliases whose bases are not imported, recalculates import-block boundaries, and recognizes address-of-wrapped import chains. Tests cover alias resolution, import classification, sorting, re-export placement, and idempotence.

Changes

Import scanning and sorting

Layer / File(s) Summary
Alias resolution and block boundaries
src/ast_scan.zig, src/ast_scan_test.zig
Import records alias resolution state. Unresolved aliases are removed, and import-block boundaries are recalculated. Tests verify these cases.
Address-of import classification
src/ast_scan.zig, src/ast_scan_test.zig
Import and declaration scanning unwraps & expressions. Tests distinguish address-of import chains from local identifiers.
Sorting and re-export validation
src/zsort_test.zig
Tests cover resolved aliases, local-module re-exports, address-of import ordering, --bottom behavior, and stable multi-entry re-export blocks.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing import alias resolution and related import detection behavior.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug-fixes

Comment @coderabbitai help to get the list of available commands.

@mstdokumaci mstdokumaci changed the title Bug Fixes Fix import alias resolution Aug 11, 2026
@mstdokumaci
mstdokumaci merged commit 37411f6 into main Aug 11, 2026
11 checks passed
@mstdokumaci
mstdokumaci deleted the bug-fixes branch August 11, 2026 09:40
This was referenced Aug 11, 2026
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