Repository navigation
compiler: enforce library visibility for pub functions - #205
Merged
Merged
Conversation
- Track the owning library for every function AST node; cross-library lookup only resolves pub declarations, same-library internals stay callable. Hidden symbols fall through to the existing N06 diagnostic. - Filter module-qualified calls (`m.f()`) through the same visibility check instead of only matching name and file id. - Register pub functions in their library export table. - Tag the stdlib public API with the tail `pub` label; internal helpers (`_grow_*`, `grow_*`, `fpow2i`, scheduler internals) stay private. - Teach the bootstrap parser the tail `, pub:` label with loud rejection of unknown tags. - Add test_pub_visibility covering same-library internals, stdlib export visibility, and hidden stdlib internals. - Relock the ccr canary: +7B in STR for the interned `pub` label; the canary ELF is byte-identical.
dslsdzc
force-pushed
the
pub-visibility
branch
from
October 26, 2026 08:26
6983786 to
c14f13c
Compare
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函数尾标签现在真正参与可见性判定:库内部默认不可见,跨库只命中pub。find_sym/find_gsym/find_func跨库时只命中pub,非pub静默跳过(调用点自然报N06 Undefined function)。m.f()同样按可见性过滤,隐藏时静默报未定义。pub写入所属库导出表。pub声明时开启,避免普通编译/标准库自身触发过滤,canary 5/5 不变。, pub:尾标签(未知标签响亮报错)。tests/selfhost/test_pub_visibility.py,覆盖同库内部调用、pub导出、标准库内部函数不可见。验证
selfhost-tests全绿bootstrap-tests全绿check全绿canary5/5 不变