Commit Graph
11 Commits
Author SHA1 Message Date
TermiNexus 16d0302b08 fix(compiler): stub 注入泛型类跳过方法 declare,修复 ndarray[T] 错误特化
Phase2 翻译 App 文件注入 numpy stub 时,_inject_method_declare 解析
class ndarray[T] 的模板签名(ndarray[T] | t.CPtr),T 无上下文可替换
→ _specialize_generic_class("ndarray", ["T"]) 递归崩溃。泛型类
(type_params 非空)跳过方法 declare 注入,具体特化方法 define 已由
Phase1 生成,返回类型仍走 vpi 返回注解缓存泛型归一化。
(含 4 处 TC-DBG 定位插桩,验证后移除)
2026-08-08 16:33:04 +08:00
TermiNexus ee8f532dc5 fix(compiler): 泛型注解收集类型实参时替换泛型参数 T + 属性访问 fail-fast traceback
- _get_type_name_from_annotation Name 分支应用 resolve_generic_type_name,
  修复 ndarray[T] 二次递归特化崩溃(SimdTest numpy)
- _specialize_generic_class 入口防御性替换残留类型参数名
- translate_attribute/get_attribute_ptr 非指针属性访问改 fatal_error(Python traceback 风格)
- c.Deref(ptr).attr 属性访问 base 取指针本身不做 load
- list[str] 容器 elem_size 4→8 修复(str 是指针 8 字节)
- 泛型函数显式类型参数 xxx[T](x) 回退普通函数调用;T(v) 转换走 resolve_annotation_type
2026-08-08 15:23:48 +08:00
TermiNexus e0303c46f6 fix(compiler): 裸类形参按引用传参 + 同名类优先本模块 + 裸名泛型构造/类型参数转换
- 裸类形参(方法+函数)解析为 Ptr(struct),修复 GSList[T].append 按值传参悬垂(G5 Test4 head.Value 读到垃圾)

- resolve_annotation_type 裸类名优先 find_struct_by_module 命中本模块,避免跨模块同名类(main.vp G5Node vs g5container.vp)类型混用

- translate_call 新增裸名泛型类模板构造:Box(42)→从实参推断→特化→构造(GenericTest Test4/5/10、GenericTest2 Stack/Range 等)

- 类型转换路径先 resolve_generic_type_name:类特化/泛型函数中的 T(x) 解析为 int/str/bool/double 转换

- 泛型函数翻译时设泛型上下文 T→int(TPV 泛型函数按普通 i32 函数编译,退出作用域前清除)
2026-08-08 11:54:32 +08:00
TermiNexus 9322ac469f fix(core): 泛型特化翻译并入模板模块 imports,消除跨模块误报 2026-08-07 22:36:22 +08:00
TermiNexus 89cc30c757 基本稳定 2026-08-07 19:32:46 +08:00
TermiNexus f8436c74d2 提交新的建议忽略 2026-08-06 18:08:09 +08:00
TermiNexus 8ad500c4da 基本稳定可以编译 Test 2026-08-05 20:12:08 +08:00
TermiNexus a3b9bdc409 修正了逻辑,使 TPV 可以编译 Test,但自举还有一段距离 2026-08-03 02:01:20 +08:00
TermiNexus 9dcf34599d 升级了仿 Python 错误堆栈提示,修复了 bool 不存在的问题,将 bool 改为 i1 而非 i8,实现了 bool 的归一化 2026-07-31 04:12:12 +08:00
TermiNexus bfb55d68f4 取消了 i8* == i8* 实际使用 strcmp 的规则,修复了诸多 Bug 2026-07-30 21:56:19 +08:00
TermiNexus d227bee139 将 .py 和 .pyi 后缀名改为了 .vp 和 .vpi 后缀名 2026-07-30 16:34:50 +08:00