module style 2: Isolate the module resolver and start being able to test it independently of module style, which requires more changes - #327
Merged
Conversation
prozacchiwawa
marked this pull request as ready for review
February 17, 2026 10:09
…g imports so the reader is aware they're not supposed to apply to the header part. Break out keyword type earlier so we can forbid 'as' in hiding, (not strictly necessary, but 'as' never does anything more for hiding. Add an additional 'as' test.
…he name location for the full defnsref result in frontend, simplifying things. Reassign the bindings in order when rebuilding a namespace resolved assign form in the module resolver, for consistency even though these should always be considered in topologically sorted order.
…py+paste error from when the code was structured a bit differently.
…veloped and relates to phantom helpers created by type definitions. It isn't needed yet and should be improved when it is.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Qualified name lookup skips parent namespace check
- Added a parent-namespace compatibility guard in the direct helper-match loop so qualified names no longer resolve to unrelated local helpers.
Or push these changes by commenting:
@cursor push eb283ac921
Preview (eb283ac921)
diff --git a/src/compiler/resolve.rs b/src/compiler/resolve.rs
--- a/src/compiler/resolve.rs
+++ b/src/compiler/resolve.rs
@@ -170,7 +170,8 @@
// check the matching namespace to the one specified to see if we can find the
// target.
for h in home_ns.iter() {
- if h.helper.name() == &child
+ if (parent.is_none() || parent.as_ref() == parent_ns)
+ && h.helper.name() == &child
&& !matches!(
h.helper,
HelperForm::Defnsref(_) | HelperForm::Defnamespace(_)This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
…122-start-resolve
…122-start-resolve
aqk
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Note
Medium Risk
Introduces new namespace/import parsing and a new resolution pass that rewrites helper references, which can change name binding and helper selection during compilation. Risk is moderate because it touches frontend parsing/tree-shaking and adds substantial new resolution logic with new error paths.
Overview
Adds module-style plumbing by introducing new
HelperFormvariants for(namespace ...)and(import ...), plus supporting types to parse dottedImportLongNames andimportspecs (qualified,exposing,hiding, andasrenames).Implements a new
compiler::resolvepass (resolve_namespaces) that walks expressions/helpers, resolves referenced helpers through active imports, rewrites calls to fully-qualified names, and pulls in the required helper definitions; classicdefmacrousage is rejected in this module-style resolver path.Updates the frontend to parse
namespace/import, be more tolerant via helper-headatomize(), and to keep namespace declarations during live-helper filtering; updates rename logic to handle namespace containers; exportscodegenand makesdo_desugar/is_at_capturepublic; adds targeted resolver tests undersrc/tests/compiler/resolve.rs.Reviewed by Cursor Bugbot for commit d3f062c. Bugbot is set up for automated code reviews on this repo. Configure here.