Skip to content

Implement absolute paths with a leading :: - #29571

Draft
mohammadfawaz wants to merge 2 commits into
masterfrom
mohammadfawaz/28772
Draft

Implement absolute paths with a leading ::#29571
mohammadfawaz wants to merge 2 commits into
masterfrom
mohammadfawaz/28772

Conversation

@mohammadfawaz

Copy link
Copy Markdown
Collaborator

Paths written with a leading :: (e.g. ::c::item) are anchored at the root module of the current program or library, so sibling modules can share a common submodule. Explicit program locators (e.g. dep.aleo::Item) are now also root-anchored instead of being prefixed with the current module, fixing resolution of external items referenced from inside a module.

Closes #28772. Closes #29561.

A path written with a leading `::` (e.g. `::c::item`) is now anchored at the root module of the current program or
library instead of resolving relative to the current module, so sibling modules can share a common submodule.
Explicit program locators (e.g. `dep.aleo::Item`) are now also root-anchored rather than prefixed with the current
module, which fixes resolution of external items referenced from inside a module.
@mohammadfawaz mohammadfawaz self-assigned this Jul 2, 2026
@mohammadfawaz mohammadfawaz added 馃殌 feature A new feature. 馃П Core Compiler Anything related to the core compiler including parsing, analysis, transforms, codegen, etc. labels Jul 2, 2026
@mohammadfawaz
mohammadfawaz force-pushed the mohammadfawaz/28772 branch 2 times, most recently from fd82a1f to c64f601 Compare July 2, 2026 23:56
The fmt validate job type-checks each target fixture as a standalone file, so the absolute-paths fixture carries its
own program block and root-level items.

Review fixes: absolute paths consult imported libraries exactly like root-module relative paths; `::group::GEN` no
longer canonicalizes to the group generator intrinsic; a bare `::` in type position produces a parse error instead of
a panic; the absolute-prefix recovery is shared between the expression and type grammars; new parser errors quote
`::`.

The tree-sitter grammar accepts a leading `::` on path expressions and types, with corpus and rowan-compat coverage.
`Path::absolute` is skipped during serialization when false, keeping the large AST snapshot expectations unchanged.
@mohammadfawaz
mohammadfawaz force-pushed the mohammadfawaz/28772 branch from c64f601 to f301d19 Compare July 3, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

馃П Core Compiler Anything related to the core compiler including parsing, analysis, transforms, codegen, etc. 馃殌 feature A new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Sibling modules can't share a submodule [Feature] Implement absolute paths

1 participant