From 3fd875daca93d7b995411dae3fd698c2598b6731 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Thu, 20 Aug 2026 11:27:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(exprcall):=20=E5=85=84=E5=BC=9F=20Mixin=20?= =?UTF-8?q?=E5=85=9C=E5=BA=95=E8=BF=87=E6=BB=A4=E6=B3=9B=E5=9E=8B=E7=89=B9?= =?UTF-8?q?=E5=8C=96=E7=B1=BB=E5=90=8D=E2=80=94=E2=80=94=E9=98=B2=E8=AF=AF?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=20list=20=E7=89=B9=E5=8C=96=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 与 TPV CallGenCall.vp 086e792 同根因:JsonValue.__getitem__ 在 found_func 未命中时被兜底遍历 class_methods 误绑到 list[ASTptr].__getitem__ 特化函数,this 按 list 布局前移 sizeof(list) → 运行期读 -1 崩溃(Config.vp root.__getitem__)。候选类名含 '[' 时跳过。 --- lib/core/Handles/HandlesExprCall.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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}'