chore(comments): Test 仓注释英文化(R11)
把 81 个 .vp 文件的中文 # 注释与三引号文档串改写为简洁英文,每个连续注释块 <=2 行;运行时中文字符串字面量(testcheck.begin/print 等用户可见消息)保持原样。骨架比对 HEAD 与工作区 112 文件漂移 0,全量 77/77 顺序回归通过。
This commit is contained in:
1 parent
aa5a7e7250
commit
ee6461be46
81 files changed
+1231
-1925
No files matched your search
@@ -3,20 +3,15 @@ import stdio
|
||||
import testcheck
|
||||
|
||||
|
||||
# ============================================================
|
||||
# ClosureCallTest - t.CPtr 函数指针调用最小化复现
|
||||
#
|
||||
# closure_test.py 中 f: t.CPtr = make_counter() 后调用 f() 报错:
|
||||
# Undefined function: 'f'
|
||||
# 根因:f 是 t.CPtr(i8*),line 322 检查 pointee 是 FunctionType 失败
|
||||
# ============================================================
|
||||
# ClosureCallTest - minimal repro: call through a t.CPtr function pointer
|
||||
# f is t.CPtr (i8*); the compiler must treat its pointee as callable.
|
||||
|
||||
|
||||
# nonlocal 关键字测试:嵌套函数修改外层局部变量
|
||||
# nonlocal test: a nested function mutates an outer local
|
||||
def make_counter() -> t.CPtr:
|
||||
count: int = 0
|
||||
|
||||
# 内部函数(闭包)捕获 count
|
||||
# Inner closure captures count
|
||||
def counter() -> int:
|
||||
nonlocal count
|
||||
count = count + 1
|
||||
@@ -26,7 +21,7 @@ def make_counter() -> t.CPtr:
|
||||
|
||||
|
||||
def test_closure_call():
|
||||
"""验证 t.CPtr 函数指针调用"""
|
||||
"""Verify calling a t.CPtr function pointer."""
|
||||
testcheck.section("Closure call via t.CPtr")
|
||||
f: t.CPtr = make_counter()
|
||||
v: int = f()
|
||||
|
||||
Reference in new issue
Block a user