diff --git a/App/lib/core/Gen/Type/TypeGenResolve.vp b/App/lib/core/Gen/Type/TypeGenResolve.vp index 249ebef..4a18bbf 100644 --- a/App/lib/core/Gen/Type/TypeGenResolve.vp +++ b/App/lib/core/Gen/Type/TypeGenResolve.vp @@ -3325,6 +3325,25 @@ novirtual class TypeGenResolve(TypeGenBase.TypeGenBase): if mod_entry_v is not None and mod_entry_v.Ty is not None: # 裸类名(含 mod.Class 限定名)恒为原型(见上方同口径注释) return mod_entry_v.Ty + # 未命中 ⇒ 该模块可能只是**重导出**(普通模块的 from-import 重导出 + # 不像包 __init__ 那样登记别名 entry,见 VpiReader. + # _inject_reexport_class_declare 仅对包 __init__ 触发)。现场: + # includes/vthreading.vp 的 `from lock import Lock`,调用方写 + # `vthreading.Lock`(Test/ThreadingTest/App/main.vp:184)⇒ 按 + # vthreading sha1 查不到 Lock。此时校正为该类的**真定义模块** + # SHA1 再查一次(唯一真源 _class_true_def_sha1,与 + # _normalize_type_name 规则 4b 同口径;无证据时原样返回 ⇒ + # 已命中的既有情形在此路径上逐字不变)。 + mod_sha1_td: str = self._class_true_def_sha1(pool, at.attr, mod_sha1_v) + if string.strcmp(mod_sha1_td, mod_sha1_v) != 0: + full_q_td: str = self._concat_sha1_class(pool, mod_sha1_td, at.attr) + if full_q_td is not None: + full_ty_td: llvmlite.LLVMType* = self.Gen.StructGen.get_struct_type(full_q_td) + if full_ty_td is not None: + return full_ty_td + mod_entry_td: GenTypes.StructEntry* = self.Gen.StructGen.find_struct_by_module(at.attr, mod_sha1_td) + if mod_entry_td is not None and mod_entry_td.Ty is not None: + return mod_entry_td.Ty # 模块可解析但类未注册:不裸名回退(防跨库抓错), # 落到下方枚举/typedef 尝试;struct 缺失由调用侧暴露 # 模块名未登记(未编译/未扫描):同样不裸名回退