Repository navigation
lib: qualify enum/interface/alias identity, field pub, import cycles - #219
Merged
Merged
Conversation
- Extend the declaration map to enums, interfaces and type aliases. Each colliding declaration gets an internal unique name; symbols/exports keep the source name and TYP_NAMED carries the unique identity. find_enum/find_iface resolve through the visibility-aware symbol and handle unique names; impl edges are remapped to the qualified names. - Field-level pub: parser accepts field tail tags (pub/mut/apx); fields default to library-internal. Cross-library field reads/writes, struct literals and patterns treat a non-pub field as unknown (N03/TS02). MemLayout fields are marked pub; Bits32/IntMap internals stay private. - Import graph: importing the entry file reports a cycle instead of loading it twice; already-loaded sibling paths are diamond-deduplicated. - Type self-test pins g_cur_lib = -1 so declaration-table lookups keep their direct semantics. - Docs/tests updated. Selfhost/bootstrap/check green; canary 5/5 unchanged.
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.
概要
补齐同名身份的剩余类型、字段级 pub 与 import 图身份。
1. enum / interface / type alias 身份
assign_unique_*_names对四类声明做同样的跨库同名检测:冲突声明得到内部唯一名,符号/导出保留源名,TYP_NAMED使用唯一名。find_enum/find_iface经可见性感知的符号解析;impl边重映射到限定名。2. 字段级 pub
parser 接受字段尾部标签
, pub/, mut/, apx。字段默认库内私有;pub结构体的字段需要, pub才能跨库读写、字面量构造和模式访问。MemLayout的四个字段标 pub;Bits32/IntMap内部字段保持私有。3. import 图
error: import cycle: '...' resolves to the entry file。判据
ShownEnum/ShownAlias/ShownIface:各自绑定自己的声明,运行 42。import bits后读Bits32.value→ N03;stdpubMemLayout字段可读。import主文件 → cycle;菱形导入运行 42。selfhost-tests/bootstrap-tests/check全绿;canary5/5 不变。