From b28f20cce780b4858f13ec5d48e5ae906754864c Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Wed, 16 Sep 2026 10:32:40 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B8=85=E7=90=86=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E4=B8=8E=E5=A4=B1=E6=95=88=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CallGenCall.vp: 前次清理 DBG 打印后 import stdio 已无使用者,删除(该文件全文无 stdio. 调用,亦无经本模块的外部访问) Test/App/nested_match_test.vp: 删除 _init_mbuddy 与 test_single_match 中的 8 处 [DBG] 进度打印;该测试的判定只看 --- Test N --- / OK / FAIL 行,test_main.vp 亦只取返回码,无断言引用这些文本 未改动任何逻辑(保留 FAIL: malloc for arena failed 等错误分支的真实输出) --- App/lib/core/Gen/Call/CallGenCall.vp | 3 +-- Test/App/nested_match_test.vp | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/App/lib/core/Gen/Call/CallGenCall.vp b/App/lib/core/Gen/Call/CallGenCall.vp index 66fdc46..75c4c06 100644 --- a/App/lib/core/Gen/Call/CallGenCall.vp +++ b/App/lib/core/Gen/Call/CallGenCall.vp @@ -4,7 +4,6 @@ import ast import llvmlite import memhub import string -import stdio import stdlib import viperlib import lib.core.Gen.Translator as HT @@ -656,7 +655,7 @@ class CallGenCall(CallGenBase.CallGenBase): # a83d183 的三处调用点:_translate_method_call / _translate_call_with_kwargs # / CallGenDispatch 特化分支)。本路径此前直接用调用点实参类型建 # declare:泛型特化构造 `list[T](pool, 8)` 的 elem_size 字面量 i32 会把 - # 定义侧 t.CSizeT(i64) 固化窄,且池实参(MemBuddy*/i8*)与定义侧 + # 定义侧 sizet(i64) 固化窄,且池实参(MemBuddy*/i8*)与定义侧 # MemManager* 口径不一致 → 跨模块 declare/define 不一致并经 .stub.ll # 传播到未调用该函数的消费方模块。泛型特化名({sha}.list[str].__new__) # 的定义侧注解在模板类上,由 _coerce_args_to_def_params 的模板退查解析。 diff --git a/Test/App/nested_match_test.vp b/Test/App/nested_match_test.vp index 20ebf4a..21d6b63 100644 --- a/Test/App/nested_match_test.vp +++ b/Test/App/nested_match_test.vp @@ -26,24 +26,17 @@ _NMATCH_POOL_SIZE: t.CDefine = 65536 def _init_mbuddy() -> int: """初始化内存池,返回 0=成功, 1=失败""" global _mbuddy - stdio.printf("[DBG] _init_mbuddy: start\n") arena: bytes = stdlib.malloc(_NMATCH_POOL_SIZE) - stdio.printf("[DBG] _init_mbuddy: malloc arena=%d\n", arena is None) if arena is None: stdio.printf("FAIL: malloc for arena failed\n") return 1 mb: rowptr[memhub.MemBuddy] = stdlib.malloc(memhub.MemBuddy.__sizeof__()) - stdio.printf("[DBG] _init_mbuddy: malloc mb=%d\n", mb is None) if mb is None: stdio.printf("FAIL: MemBuddy init failed\n") return 1 - stdio.printf("[DBG] _init_mbuddy: before_init\n") mb.__before_init__() - stdio.printf("[DBG] _init_mbuddy: init\n") mb.__init__(arena, sizet(_NMATCH_POOL_SIZE)) - stdio.printf("[DBG] _init_mbuddy: store\n") _mbuddy = mb - stdio.printf("[DBG] _init_mbuddy: done\n") return 0 @@ -52,7 +45,6 @@ def test_single_match() -> int: stdio.printf("--- Test 1: 单层 match LLVMType ---\n") ty: llvmlite.LLVMType | t.CPtr = llvmlite.Int32(_mbuddy) - stdio.printf("[DBG] Int32 done: %d\n", ty is None) if ty is None: stdio.printf("FAIL: Int32 returned None\n") return 1