From 9bb6dd7612f43184707d5464d2b9a032177915ef Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Thu, 13 Aug 2026 08:11:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(reachable):=20App=20=E6=BA=90=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AE=B9=E5=99=A8=E4=BE=9D=E8=B5=96=E6=B3=A8=E5=85=A5?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=20dict/list=20=E6=9C=AA=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E8=87=B4=E6=96=B9=E6=B3=95=E8=BF=94=E5=9B=9E=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=AF=AF=E6=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _BuildReachableSha1Set 扫描 App 源文件仅解析 import,未检测 list/dict 容器 使用,main.vp 用 dict 但 _dict 未纳入可达集合→不编译→dict.set_int 等无 返回类型信息→_fail_method_ret_ty 误杀(DictTest 重现)。修复:translate 后调用 _inject_auto_container_visibility 注入 _list/_dict 依赖。 --- App/lib/core/StubMerger.vp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/App/lib/core/StubMerger.vp b/App/lib/core/StubMerger.vp index dd7fa11..2f68b75 100644 --- a/App/lib/core/StubMerger.vp +++ b/App/lib/core/StubMerger.vp @@ -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)