fix(reachable): App 源文件容器依赖注入,修复 dict/list 未编译致方法返回类型误杀
_BuildReachableSha1Set 扫描 App 源文件仅解析 import,未检测 list/dict 容器 使用,main.vp 用 dict 但 _dict 未纳入可达集合→不编译→dict.set_int 等无 返回类型信息→_fail_method_ret_ty 误杀(DictTest 重现)。修复:translate 后调用 _inject_auto_container_visibility 注入 _list/_dict 依赖。
This commit is contained in:
1 parent
97f765fcb3
commit
9bb6dd7612
1 file changed
+7
@@ -1758,6 +1758,13 @@ def _BuildReachableSha1Set(mb: memhub.MemBuddy | t.CPtr, source_dir: str,
|
||||
tr.CurrentPackage = HandlesImports.compute_package_from_relpath(mb, fname)
|
||||
HandlesStruct.reset_visible_structs(mb, 0)
|
||||
tr.translate(tree)
|
||||
# 容器使用检测:App 源文件用 list/dict(裸名注解/构造/[]
|
||||
# /{} 字面量)时注入 _list/_dict 依赖(与 Phase1 对 includes
|
||||
# 层的 _ScanTreeForContainers 对齐)。否则 dict/list 类未被
|
||||
# 纳入可达集合 → 不编译 → 跨模块方法(如 dict.set_int)返回
|
||||
# 类型函数/text.ll/vpi 均未命中 → _fail_method_ret_ty 误杀
|
||||
# (DictTest 8/13 重现根因)。
|
||||
tr._inject_auto_container_visibility(mb, tree)
|
||||
# 获取 _imported_modules
|
||||
if tr._imported_modules is not None:
|
||||
im_len: t.CSizeT = string.strlen(tr._imported_modules)
|
||||
|
||||
Reference in new issue
Block a user