diff --git a/lib/core/Handles/HandlesExprCall.py b/lib/core/Handles/HandlesExprCall.py index c9d5e8b..8d15244 100644 --- a/lib/core/Handles/HandlesExprCall.py +++ b/lib/core/Handles/HandlesExprCall.py @@ -3170,9 +3170,17 @@ class ExprCallHandle(BaseHandle): # 已注册类找定义类,this 由 _adjust_this_for_inherited_method 按 # 组合布局前移 sizeof(定义类 struct)。修复 TPC 编译 TPV 的 # undefined symbol: .BaseB.helper / StmtGenDeclMixin.translate_*。 + # 仅对普通类名兜底:泛型特化类名(list[X]/dict[K,V],含 '[')是 + # 模板容器,其特化函数(如 list[ASTptr].__getitem__)在模块中存在 + # 但绝非"兄弟 Mixin"——若不过滤,JsonValue.__getitem__ 等普通 + # 方法调用在找不到时会误绑定到 list 特化函数,this 按 list 布局 + # 前移 sizeof(list) → 运行期读 -1 崩溃(Config.vp 的 + # root.__getitem__ 根因,与 TPV CallGenCall.vp 兜底修复一致)。 for _cand_cls, _cand_methods in list(Gen.class_methods.items()): if _cand_cls == ClassName: continue + if '[' in _cand_cls: + continue if not any(_cm.endswith(f'.{MethodName}') or _cm == MethodName for _cm in _cand_methods): continue _cand_full = f'{_cand_cls}.{MethodName}'