Resolve relative multi-segment type paths - #127
Merged
Conversation
A qualified type path such as `Outer::Header` (a nested item referenced from inside `Outer`'s own body) or `sub::inner::Header` (module-relative) either reported a misleading leaf-only `NotFound` or stalled with "type resolution will not terminate". Fix both halves of the resolution path: - `TypeRegistry::resolve_path` / `NameIndex::resolve_path` now try each base in empty() U scope prefixed onto the path (mirroring the doc-links resolver), so a relative multi-segment path resolves inline. A miss reports the full written path, not just the leaf. - `collect_value_refs` resolves a qualified `Ident` path through the index, so the referencing item's owner is awaited and the build no longer stalls. Add `ItemPath::join_path` to share the base-join between the two resolves. The C++ backend now emits nested type declarations before the parent's fields (and value items after), so a field may reference a nested type by name; add a same-module guard in the dep walker to avoid a bogus self-include. Add semantic tests for the qualified/relative/ bare-nested cases, extend the codegen corpus to exercise same-body qualified nested references, and update the language reference. Closes #125
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.
Closes #125
Qualified type paths such as
Outer::Header(a nested item referenced from insideOuter's own body) orsub::inner::Header(module-relative) previously either reported a misleading leaf-onlyNotFoundor stalled with "type resolution will not terminate".Fix
TypeRegistry::resolve_path/NameIndex::resolve_pathnow scanempty() ∪ scopebases prefixed onto the path (mirroring the doc-links resolver), so relative multi-segment paths resolve inline; a miss reports the full written path.collect_value_refsresolves qualifiedIdentpaths through the index so the owner is awaited — the stall is gone.ItemPath::join_pathshares the base-join between both resolves.#includeself-include. (Operator-directed.)Verification
python test.pygreen (clippy, nightly fmt, unit, corpus across all backends, doc build).pyxis-defsRust + C++ build checks both pass (JustCause2/3, MadMax).Notes / follow-ups (out of scope)
*Outer::Headerpointees).use'd outer module (use main::OuterthenOuter::Header).