40 Commits
Author SHA1 Message Date
cqh963852 be2eadf889 Revert "fix(checker): 推断替换引擎补 Go instantiateTypeWithAlias 入口闸——递归型别名体深替换产 alias=None 自引用壳的无界增殖(compiler/typeArgumentInferenceWithRecursivelyReferencedTypeAliasToTypeLiteral01/02 worker signal 6)"
This reverts commit 37403e34a9.
2026-10-24 00:04:03 +08:00
cqh963852 c97b63cb77 fix(checker): 节点级 type_to_type_node_worker 补 Go 别名门与环守卫——递归型别名 .types 通道无限节点重建内存失控(compiler/declarationEmitInferredTypeAlias4/8/9.ts worker signal 6)
根因:.types 基线 write_type_line 对型别名声明名额外建节点判 Identifier(types_baseline.rs:202 checker.type_to_type_node),落到 nodebuilder_checker_10.rs 的简化 worker——无 Go typeToTypeNode 别名门(nodebuilderimpl.go:3531-3554:t.alias 非空且符号可及时先于联合/交集/型参臂按 symbolToTypeNode(Type,实参) 呈现命名引用)也无任何环守卫;type Foo<T> = T | { x: Foo<T> } 的实例化属性链经 union_to_type_node(只查 origin 不查 alias)→ type_literal_to_type_node → get_type_of_symbol(属性) → 同名自实例化 union 无限重建 AST 节点,RLIMIT_AS 分配死亡螺旋熔断 signal 6。同族 4(函数内局部别名)/8(无 export)共 burn 3.0-5.0s;非递归别名(1-3/5/7)与递归接口(recursiveUnionTypeInference,is_alias_declaration_name 不命中 TypeAlias 分支)不受影响 PASS 佐证。

修复(对齐 Go,非自设上限):
- worker 外壳加进行中栈守卫(node_type_print_stack 按 Arc 身份判重入,命中回退 any 关键字节点),语义对应 Go 联合/匿名对象序列化的 visitedTypes 环消隐(nodebuilderimpl.go:3020-3025 typeToTypeNodeOrCircularityElision + 2978-2996 createAnonymousTypeNodeEx);此前命中的图必为无限重建(必然 crash),不存在可回归的 PASS 输出。
- worker 内 boolean 臂与联合臂之间插别名门:is_type_symbol_accessible(alias 符号, type_render_enclosing/display_enclosing_node) 可及即按引用呈现(.types 通道 maxExpansionDepth<0 对应 shouldExpandType 恒 false),Array 单实参走 array_type_node;局部别名(case 4)门关时由环守卫承接终止。worker 唯一生产消费点为 types_baseline 的 IsIdentifier 判定(别名引用 TypeReference ≠ Identifier,与非递归结构渲染行为一致)。
2026-10-23 23:53:46 +08:00
cqh963852 946c4afdc7 fix(checker): 流收窄并集成员序补 Go CompareTypes 枚举臂——枚举成员按符号声明序定序先于字面量值序
stringEnumLiteralTypes1 anchor(types line 256):f12 if(x) 真值收窄 L:Choice.No | Choice.Yes 对 R:Choice.Yes | Choice.No。本例此前 sig6 于检查期熔断(/tmp/tsox-verify/20261023-143150 run.log #12222 worker crashed signal 6),字面量枚举族驻留闸修复后才到达 .types 发射,暴露此潜伏反序。

根因:flow_union_of(flow_union_ops_checker.rs:122)按 compare_union_members_ordered 排序流收窄并集,其尾部 compare_union_members_tail(utilities_has_only_expression_initialization.rs:265-284)对 RESIDENT_LITERALS(含枚举字面量的 StringLiteral 位)直落 compare_type_data 值序("no"<"yes"),缺 Go CompareTypes 先行的枚举臂——utilities.go:552-555 case t1.flags&(Enum|EnumLiteral|UniqueESSymbol) 经 compareSymbols 按符号(即声明序)定序,先于 utilities.go:556+ 的字面量值序臂。构造侧 add_types_to_union(checker.go:26412-26418 SortStableFunc(CompareTypes))的对应实现 compare_types_ordered(utilities_has_only_expression_initialization.rs:549-554)已有该臂,故 YesNo/NoYes 别名联合序正确,仅 flow_union_of 直构路径漏带。

修复:compare_union_members_ordered 于 Object 臂后并列枚举臂(与 Go switch 位序一致),双成员均 Enum|EnumLiteral|UniqueESSymbol 时经 checker 侧 compare_symbols_worker(func_alignment exact 对齐 compareSymbolsWorker,m3a_2.rs:214)按首声明位置定序。

已知未动隐患(本 commit 不扩面):自由函数 compare_types(同文件 :341)同样缺枚举臂,被 m1h_2.rs:31 insert_type / m2b_3.rs:432 remove_type 用作 binary_search 查找序——构造序(声明序)与查找序(值序)在含同枚举多成员的联合上不一致,main 既有状态,未观测到失败例,留待独立对齐(Go 由 t.checker 单比较器全域一致)。
2026-10-23 23:52:03 +08:00
cqh963852 9f87a6bf71 fix(checker): 节点路径 EnumLike 非成员闸补齐 Go typeToTypeNode 终止语义——type_to_type_node_worker 联合分发先于符号名路径,formatUnionTypes(m2g_3.rs:322)对整族枚举成员(UnknownYesNo 恰 3 成员)坍缩回枚举本体后单成员重入联合分发,union_to_type_node ↔ format_union_types 无限互递归栈耗尽(gdb 实证 20+ 同构帧,快检 1.30s sig6);对齐 Go nodebuilderimpl.go:3444-3452:EnumLike 非成员(枚举联合/计算枚举型)默认经 symbolToTypeNode 按名渲染,expandingEnum 展开仅 verbosity 上下文放行(nodebuilder.go:39-46 非 hover 恒 maxExpansionDepth=-1 即恒按名),本 Checker 节点路径即非 verbosity 消费方(hover 走 NodeBuilderImpl,m2g.rs:59 should_expand_type 同款闸自带)。首轮三笔驻留闸(ddd82ce/12320f6/52b6b72)使检查期完成、.types 发射期到达此潜伏环(此前 8s 检查期先熔断不可达);枚举成员字面量仍由上方 literal_value 臂渲染(与 Go EnumLike 成员臂的 Choice.Yes 形态存既有分歧,输出层 string 路径不受影响,留待独立对齐) 2026-10-23 23:52:03 +08:00
cqh963852 0beef585fc fix(checker): regular 驻留臂尾表达式改 return【机械错修复,E0308】——快检 stderr(/tmp/xtask-w2.err:2448-2462)实证 ddd82ce 在 checker_impl_chunk_checker_5.rs:184 把 regular 作 if let 块尾值表达式,无 else 的 if 语句块型须 (),rustc 报 error[E0308] expected () found Arc<Type>(唯一编译错,tsox-checker lib 因 1 error 失败);改为 return regular; 与块内其余早退臂同构,语义不变(该路径本就必须返回该值) 2026-10-23 23:52:03 +08:00
cqh963852 2178c976ff fix(checker): 枚举声明型构造改走 get_union_type_ex 入口——get_declared_type_of_enum 原先直通 get_union_type_worker,绕过 Go getUnionTypeEx(checker.go:26226-26251)入口层的空/单成员短路与双成员 unionOfUnionTypes 驻留(Go getDeclaredTypeOfEnum checker.go:24471 即经 getUnionTypeEx);枚举型经 declared_type_links 单次驻留故主路径等价,但两成员其一为联合(动态名/计算成员混入)时同构联合自此经 (id1,id2,归约档,alias 键) 命中驻留不再重复重建。与 c7892bb/34db7eb 同族:字面量/枚举联合的 Go 驻留闸补齐,斩 crash sig6 字面量枚举族的身份失稳放大链 2026-10-23 23:52:03 +08:00
cqh963852 c0f6a6410b fix(checker): 字面量联合基型接 Go LiteralUnionBaseType 驻留——get_base_type_of_literal_type 联合臂原先对混合基型成员(如 A|B.foo 两枚举、enum|null、string 字面量与模板混联)每次铸全新 Arc+全新 type id 的裸联合;Go getBaseTypeOfLiteralTypeUnion(checker.go:26064-26072)以 cachedTypes[CachedTypeKindLiteralUnionBaseType, typeId] 单次驻留。本仓 CachedTypeKind::LiteralUnionBaseType 枚举项已定义(types_cached_type_kind.rs:9)但零使用者(死槽位);因函数持 &self 无法写 self.cached_types,按 r26k3_defs 先例以 thread_local HashMap<u32,Arc<Type>>(键=全局唯一 type id)落地,pool_reset 登记逐例清空防跨例泄漏。早退臂(单成员/全同基)返回稳定指针不驻留,仅差异重建产物驻留;推断 literalTypesWithSameBaseType(inference.go:1613-1626)与运算符基型化(checker.go:12989-12990)对该函数的高频重复查询自此命中同实例 2026-10-23 23:52:03 +08:00
cqh963852 7e86747289 fix(checker): 字面量联合 regular 型补 u.regularType 驻留——get_regular_type_of_literal_type 联合臂原先每次经 build_union_from_types 铸全新 Arc+全新 type id,Go(checker.go:25861-25870 getRegularTypeOfLiteralType)在 UnionTypeData.regularType 单次驻留、后续查询恒同实例;id 失稳使 union_types/unionOfUnionTypes/relation_cache 等一切 id 键缓存对 regular 化产物永不命中(字面量/枚举联合族 crash sig6 的身份失稳放大器:枚举成员声明型为 fresh、.types 发射与关系判定反复 regular 化时联合重复重建累积)。本仓 UnionTypeData.regular_type OnceLock 槽位已存在(types_impl_chunk_2.rs:96-97)但该路径从未写入;全 ptr_eq 恒等臂不驻留(返回原 Arc 即稳定,避免自引用 Arc 环),仅差异重建产物驻留 2026-10-23 23:52:03 +08:00
cqh963852 37403e34a9 fix(checker): 推断替换引擎补 Go instantiateTypeWithAlias 入口闸——递归型别名体深替换产 alias=None 自引用壳的无界增殖(compiler/typeArgumentInferenceWithRecursivelyReferencedTypeAliasToTypeLiteral01/02 worker signal 6)
用例:type TreeNode = { name: string; parent: TreeNode }; var nodes: TreeNode[]; nodes.map(n => n.name);
非泛型顶层递归别名×map 型参推断,worker 燃烧 ~6s 后 signal 6(run.log #6478,mem-per-case 无采样即崩)。

Go 断点对位(语义已核实):
- instantiateTypeWithAlias(checker.go:22601-22608)入口早退:!(couldContainTypeVariables(t) || alias实参可含变量) 时原样返回 t,深度闸(22610)之前;
- couldContainTypeVariablesWorker(checker.go:22710-22724)Object 分支被 isNonGenericTopLevelType(checker.go:22727-22741)压制:顶层无实参别名声明的体型恒判假——TreeNode 的对象字面量体永不进代入/实例化,同一对象+alias 全程保真,关系/推断/打印全走恒等短路。

Rust 根因:m1h_2.rs instantiate_type_with_alias:132-141 已带同款闸,但推断侧并行引擎 substitute_infer_type_parameters(relater_probing_checker_4.rs)只并入了深度计数(此前 recursiveConditionalTypes 修复),入口闸缺失。map 推断对 callbackfn 参数型代入时(inference_checker_8.rs:1291 inst_param)下钻 value: TreeNode 落 substitute_infer_object 的 deep 分支(deep_ok 只查 Anonymous+TypeLiteral 符号,漏非泛型顶层别名排除)→ substitute_object_properties_deep:递归成员 parent 的 in-progress 自引用命中返回新壳(alias=None、新 id),"changed" 虚真——每轮代入产新对象且 could_contain 翻真(is_non_generic_top_level_type 依赖 alias 位),以 id/指针为键的环闸(infer visited 配对、relater relation_in_progress、type_print_stack)对新壳全部 miss,同族 9 例(deepComparisons/varianceMeasurement/unionTypeWithRecursiveSubtypeReduction3/complexRecursiveCollections 等)呈内存增殖崩溃(sig6/sig9 混合信号与 RLIMIT_AS 分配失败吻合)。

修复:substitute_infer_type_parameters 入口补 Go 同款闸(could_contain_type_variables(t) 假且 alias 实参无可含变量 → 原样返回)。恒等性安全:infer_param_matches(relater_probing_checker_4.rs:20-33)仅匹配类型参数,无可含变量型的代入在两实现下均为恒等;非顶层 TypeLiteral(函数局部别名体)could_contain 仍真、深替换路径不变。

本例效果预期:TreeNode 体保持单例,n : TreeNode(基线 .types 行23)、nodes.map(n => n.name) : string[]、仅 TS2454 一错,与 Go 基线一致。
2026-10-23 23:51:45 +08:00
cqh963852 1bd52e7214 fix(checker): 数组绑定模式 contextual 初始化式类型统一走 getTypeFromBindingPattern——全量轮分片实证同族 destructuringArrayBindingPatternAndAssignment5SiblingInitializer 仍 TS7022×6(a1/a2 裸标识符亦环):get_contextual_type_for_initializer_expression 对 ArrayBindingPattern 拆走手搓 implied_type_of_array_binding_pattern(不压 contextualBindingPatterns 栈,成员初始化式经 get_type_of_node 拉取无 checkIdentifier 断环闸),窗口内 sibling 引用解析符号触发 pushTypeResolution 环;Go checker.go:30076-30080 两种模式统一 getTypeFromBindingPattern(declaration.Name(), includePatternInType=true, false)——该入口压栈(m1g_2.rs:209-211)且成员初始化式经 checkDeclarationInitializer 检查路径过闸(m1g_2.rs:380-391),数组 implied 型由 get_type_from_array_binding_pattern(m1g_2.rs:316,Go checker.go:18380 移植,含 rest-only 模式 createIterableType 语义);删除失去调用者的手搓函数 2026-10-23 23:51:45 +08:00
cqh963852 a7992212a7 fix(checker): 解构判别收窄臂补 Go 联合父型闸——快检 .types 实证裸标识符初始化式语句 b1 全错(f1/f2 b1:any vs number/string、f3 b1:number vs string|number)而 a1 引用型正确:narrow_destructured_symbol_type 原先 is_nested||!union 即走 narrow_destructured_by_element_access 流 walk(非联合父型也走),Go checker.go:14027 整段窄化体被 parentTypeConstraint.flags&TypeFlagsUnion!=0 闸死且参数根体内有赋值豁免(!(isParameterDeclaration&&isSomeSymbolAssigned)),非联合父型(sibling 初始化式场景的对象字面量/元组父型)Go 完全不收窄;本侧对非联合父型跑流 walk,其内部 get_initial_type/get_type_with_default 链对 sibling 引用产生的瞬态产物(any/never)经 check_identifier 的窄化覆盖块(m1b_2.rs:173-181)盖掉声明型,b1=union(nonUndefined(t),X) 的 X 被污染(f1 X=any、f3 X=never 经 Subtype 归约呈 number);修复对齐 Go 闸:非联合父型或参数根已赋值直接 None,联合父型保留 is_nested 分支与模式伪引用分支原行为 2026-10-23 23:51:45 +08:00
cqh963852 53c869397f fix(checker): 拉取链补 checkIdentifier 断环闸 + binary worker 臂脱缓存层——快检分片实证 5 错全落二元初始化式语句(TS7022×3 a2 自引用环、TS2365、TS2322),裸标识符语句零错:Go 表达式标识符全部定型路径同经 checkExpressionEx→checkIdentifier 过 contextualBindingPatterns 闸(检查路径与 getRegularTypeOfExpression 拉取路径),本侧拉取链 compute_type_of_node→get_type_of_identifier(checker_impl_chunk_6_checker.rs:509 唯一调用点)不经 check_identifier,implied pattern type 窗口内 1+a2 的操作数经 check_binary_expression 的 plus 错误检查(checker_operators.rs:205-208)与 get_type_of_binary_expression 双双 get_type_of_node 拉取 a2 → 窗口内解析 a2 符号 → pushTypeResolution 环 → TS7022 + resolvedType 驻留 errorType(渲染 any);修复①get_type_of_node 入口 Identifier 臂前设闸(m1b_2.rs 新增 contextual_binding_pattern_guard_type,条件与 check_identifier 闸逐字同构 checker.go:11298-11304),瞬态 nonInferrableAny 不读不写节点缓存(Go 该值仅上下文期存在);②worker BinaryExpression 臂(m1b.rs:420)get_type_of_node 改直调 get_type_of_binary_expression——Go checkExpressionWorker(checker.go:8007-8008)直返 checkBinaryExpression 型不驻节点缓存,经拉取层会把窗口瞬态 any 写进 binary 节点缓存,终检 check_expression_cached_ex 回放瞬态(1+a2 恒 any) 2026-10-23 23:51:45 +08:00
cqh963852 46ed81103f fix(checker): contextualBindingPatterns 断环闸接通真实栈存储并修谓词语义——check_identifier 的兄弟初始化器早退闸(m1b_2.rs:141-148,对齐 Go checker.go:11298-11304 'const [a, b = a + 1] = [2]' 注释例)原先读 r23k1_defs 的独立 thread_local CONTEXTUAL_BINDING_PATTERNS,而 get_type_from_binding_pattern 的 push/pop 写的是 r24k16_defs 的另一个同名 vec(迁移双落点),contains 恒 false 闸死:implied pattern type 计算期内兄弟绑定引用不走 nonInferrableAnyType 早退而落入符号型机(pushTypeResolution 环→errorType/循环诊断污染,errors 基线必挂);谓词亦错位(p.parent()==decl 应为 pushed pattern==decl.parent(),Go slices.Contains(contextualBindingPatterns, declaration.Parent));修复统一到 r24k16_defs 单存储+Go 谓词,删 r23k1_defs 死 vec/死 reset(pool_reset 接线同步收敛到 r24k16 单点) 2026-10-23 23:51:45 +08:00
cqh963852 c9c2ca771f fix(checker): 解构收窄闸前移到父型解析之前对齐 Go NodeCheckFlagsInCheckIdentifier 时序——narrow_destructured_symbol_type 原先把 binding_pattern_narrowing_stack 闸查/置在 type_for_binding_pattern_parent 之后(flow_narrow_destructured_checker.rs 旧 74-79 行序),而兄弟初始化器环恰从该调用内再入(type_for_binding_pattern_parent → initial_type_of_declaration → get_type_of_initializer(rhs 未缓存) → check rhs → contextual implied pattern → 兄弟 b1elem 初始化式引用 a1 → check_identifier → narrow_destructured_symbol_type 再入),闸永不被检查即递归,每层全新 implied 模式型+符号分配直至 RLIMIT_AS 耗尽 SIGABRT(destructuringObjectBindingPatternAndAssignment9SiblingInitializer 8.97s crash sig6);Go checker.go:14013-14026 将 NodeCheckFlagsInCheckIdentifier 置位放在 getTypeForBindingElementParent 之前、父型+约束解析后、流收窄前清除(Guard parent-type resolution only; flow analysis should allow re-entrant narrowing),闸键为 declaration.Parent.Parent(pattern_parent);修复按此时序前移,闸键同步对齐 pattern_parent.id() 2026-10-23 23:51:45 +08:00
cqh963852 1a6f89d543 fix(checker): is_syntactic_default 第四臂 kind 对齐 Go——NamespaceExportDeclaration 改 NamespaceExport(utilities.go:250-255,export * as default 子句非 NamespaceExportDeclaration) 2026-10-23 23:51:25 +08:00
cqh963852 e14cc10d73 fix(checker): 合成 default 压过真实 .default——自研链 resolve_default_export_target_for 补齐 Go getTargetOfModuleDefault 的 hasSyntheticDefault 压制语义(checker.go:14886-14895):exportDefaultSymbol 命中后 hasSyntheticDefault/hasDefaultOnly 为真时按发射行为返回 resolveExternalModuleSymbol(模块符号本体),canHaveSyntheticDefault 的 node16/nodenext 臂(checker.go:15653-15655)对 ESM 使用处导入 CJS 目标恒真(node16/nodenext 下 CommonJS 模块被 import 进 ESM 时总有合成 default);本侧此前仅 target.is_none() 时查 module_can_have_synthetic_default,default 命中即直返——nodeModulesTripleSlashReferenceModeDeclarationEmit7 的 index.ts(ESM)import obj2 from "./sub2/uses.js"(sub2 type:commonjs、无 esModuleInterop)直落 sub2 的 default 导出 RequireInterface,obj2.default 误报 TS2339(Go 基线 obj2 : typeof obj2、obj2.default : RequireInterface,.types 全零错误);修复:default 命中且携带使用点说明符时先 can_have_synthetic_default(既有移植 r22k5_defs.rs,node16 ESM→CJS 判定链 emit 语法/隐含格式均已接线),命中改返模块符号;import_declaration_context 返回值补说明符节点供使用点判定,hover 调用点传 None 维持显示通道语义不变 2026-10-23 23:51:25 +08:00
cqh963852 c4430b2338 fix(checker): resolve_module_spec_from 非相对说明符补 ambient 先行——Go resolveExternalModule(checker.go:15474-15477)tryFindAmbientModule 先于程序解析记录与磁盘解析命中即返回;本侧 import 别名活路径 resolve_alias_target(ImportClause default 臂)→ import_declaration_context → resolve_module_spec_from 走 resolve_package_symbol_from(程序期记录/磁盘先行、无 ambient 查表),node_modules 包内 declare module "x"(impliedNodeFormatInterop1 的 highlight.js/index.d.ts 顶层同名 ambient 声明)被按 package.json types 解析出的文件符号压过:core.d.ts 的 import hljs from "highlight.js" 落 index.d.ts 文件符号,esModuleInterop 合成 default 使绑定呈 typeof import("index"),index.ts(2,6) 误报 TS2339 Property 'highlight' does not exist;85cbd0e 只在 check_default_import_binding(诊断路径)与移植层 resolve_external_module 加了 ambient 先行,自研求值链漏配。修复:非相对分支入口先 try_find_ambient_module(globals 带引号名查表,exports_impl_chunk.rs 同款),命中即返回 ambient 合并符号,default 绑定取 ambient 导出面(HighlightAPI) 2026-10-23 23:50:58 +08:00
cqh963852 84578ce659 fix(checker): get_type_from_class_or_interface_reference 型参取法补声明聚合——Go getTypeFromClassOrInterfaceReference(checker.go:23732-23734)的 typeParameters 取声明型 LocalTypeParameters,其惰性构建即 getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(checker.go:25216-25225)按符号全部类/接口声明聚合;本侧类声明型是 TypeData::Object 壳(build_class_instance_type_with_base),as_interface_type 恒 None、local_type_parameters 恒空表,带实参的类基型引用经 resolve_base_types_of_class(wc3_5.rs:335)的 class reference 分支落 check_no_type_arguments 整体误报 TS2315——jsxInExtendsClause 的 class extends React.Component<{}, {}>(ambient class Component<A, B>)多报 jsxInExtendsClause.tsx(7,60) Type 'Component' is not generic;修复:InterfaceData 空表时从符号声明聚合(m2d_2 的 get_local_type_parameters_of_class_or_interface_or_type_alias,与 m1c_2 checkTypeParameterListsIdentical 同源等价物),真非泛型(声明无型参)聚合仍空照报 TS2315(moduleAndInterfaceSharingName2 等基线形态不变) 2026-10-23 23:50:58 +08:00
cqh963852 3c83f65d54 fix(checker): check_default_import_binding 机械错修复【构建错误修正,上笔 8680e86 引入】——快检构建 4 错实证(tsox-checker lib):①let-else 初始化器以 match 尾花括号直接接 else 违反 let-else 文法(error: right curly brace before else not allowed),改普通 let 绑定 match 产物元组 (module_symbol, module_file);②fallback 臂内 sf 逃逸作用域后 3 处下游引用(error[E0425] cannot find value sf:ESM 双档判定的 target_mode、TS1192 展示名的路径去扩展两段),改由元组携带 Option<String> 文件名——ambient 命中为 None:双 ESM 判定跳过(对齐 Go canHaveSyntheticDefault checker.go:15148 file==nil 即声明/ambient 宽松分支,不落 GetImpliedNodeFormatForEmit),展示名取符号声明名剥引号(Go symbolToString 对 ambient 模块即名字串,message 引号包裹形态一致);文件路径去扩展两段仅在 Some 分支执行,语义与原 sf 版逐行等价 2026-10-23 23:50:58 +08:00
cqh963852 041490851a fix(compile): 模块解析记录按使用点模式键控并撤按名兜底——程序期 resolved_modules 此前按文件隐含格式(implied_node_format_of_file)给全文件统一键,同名说明符的 import 声明与 require 调用坍缩同键互相覆盖;Go resolveImportsAndModuleAugmentations(fileloader.go:895)逐 import 经 getModeForUsageLocation(fileloader.go:1054:require/import= require→CommonJS,import() 按发射降级,静态 import/export 按文件发射格式,import 语法不影响解析的配置族恒 None)分键,modulePreserve2 /main.js 的 import {esm} 与 require('dep') 需分别落 import.mjs/require.js 两记录。程序期改用既有移植 m4v_2::get_mode_for_usage_location(补 source_file_meta_data_for 按 loadSourceFileMetaData 语义构造 meta:package scope type 字段在 node16..nodenext 或 node_modules 生效);检查期 resolve_external_module_path 撤 17c04b0 的「无模式按名任取已解析条目」(modulePreserve2 由此错取 require 记录致 TS2305 esm 缺失、automaticTypeDirectiveResolutionBundler 错取 default 条件 cjs.d.ts 致 TS2353):同名条目全未解析才径直判失败(保持 es6modulekindWithES5Target9 未解析 mod 族快检熔断不重建 resolver),任一已解析即存在变体歧义落 resolver 兜底;check_default_import_binding 补 ambient 先行(Go resolveExternalModule checker.go:15466-15470 tryFindAmbientModule 先于程序记录/磁盘,impliedNodeFormatInterop1 的 declare module "highlight.js" 须压过 node_modules 文件符号,否则 default 绑定落 index.d.ts 文件符号呈 typeof import("index") 致 TS2339) 2026-10-23 23:50:58 +08:00
cqh963852 d45b888f50 fix(checker): 限定名诊断左段悬空别名级联抑制——Go getSymbol(checker.go:2243-2258)对含义不匹配的命中符号若是别名,经 getSymbolFlags(checker.go:16790-16792)取链上合成标志,别名解析失败(resolveAlias 目标 unknownSymbol)返回 SymbolFlags.All,任意含义命中即返回该别名,名称解析不落「找不到命名空间」;随后 resolveEntityName 别名环解到 unknownSymbol,resolveQualifiedName(checker.go:16241-16243)对 unknownSymbol 前缀直接短路静默——悬空别名的限定名引用(let a: x.A,x 为未解析 import= require 别名)在 Go 全类错误不报。本侧 report_qualified_name_resolution_failure 缺此抑制,左段 resolve_alias_base 失败回自身(Alias 位无 NAMESPACE)径直报 TS2503,augmentExportEquals1_1/2_1 相对参考基线多出 file3.ts(3,8) Cannot find namespace 'x'(Go 基线期望仅 2307/2882 两条,x 渲染 any);修复:左段为别名且 resolve_alias_base 解回自身(失败语义)时整函数静默返回 2026-10-23 23:50:58 +08:00
cqh963852 688e8ec79b fix(binder): ambient 模块声明名归一双引号包裹——get_declaration_name 对字符串名 ModuleDeclaration 此前原样保留源引号(declare module 'M' 的符号名带单引号入表),globals 键与 tryFindAmbientMaterialModule 的 \"name\" 双引号查表口径(Go getSymbol(c.globals, \"\\\"\"+name+\"\\\"\"))永不互吻:8240792 把 checker 侧 ambient 查找从「剥引号线性扫描」改为 globals 查表后,单引号声明的 ambient 模块全部漏查,import= require/命名空间导入族误报 TS2307(ambientExternalModuleWith{Internal,Without}ImportDeclaration、ambientDeclarationsExternal、externalModuleReferenceDoubleUnderscore1、tsxElementResolution17、tsxExternalModuleEmit1/2、nodeColonModuleResolution、propertyIdentityWithPrivacyMismatch、privacyTopLevelAmbientExternalModuleImport{With,Without}Export、declFileImportedTypeUseInTypeArgPosition、exportEqualsOfModule 等 13 例回归);对齐 Go getDeclarationName(binder.go:310-317)去引号字面值统一双引号包裹,pattern-with-attributes 唯一名同步对齐 ~\"name\"pattern@id 形态(try_get_ambient_module_name_from_symbol_name 的既有解析形态,此前写读两侧形态互不匹配) 2026-10-23 23:50:58 +08:00
cqh963852 92f7f8d190 fix(checker): get_declared_type_of_alias 对将回递别名臂的目标落 errorType 终止——gdb 定位(主 agent 代跑,RLIMIT 8GB)es6modulekindWithES5Target9 快检 1.26s signal 6 的崩溃环:get_declared_type_of_symbol(exports_impl_chunk.rs:158 try_get 别名臂)↔ get_declared_type_of_alias(wc2.rs:149-150)无界互递归——未解析 import 别名经 resolve_alias 落符号自身/其合并视图(仍带 Alias 位),get_declared_type_of_symbol 重回别名臂而 declared_type_links 驻留在递归返回后才写,in-flight 无 memo 无环闸;裸 worker(无 TSOX_TYPES_EMIT_DIR)不崩,仅 .types 发射通道触发。对齐 Go getDeclaredTypeOfAlias(checker.go:24666-24671)的终止后置条件:resolveAlias 目标恒非纯别名(未解析/环落 unknownSymbol,Property 位),getDeclaredTypeOfSymbol(unknownSymbol) 经 tryGetDeclaredTypeOfSymbol(checker.go:24251-24256)无臂接取落 errorType;本仓以「目标仍带 Alias 位且无 Class|Interface|TypeParameter|TypeAlias|Enum|EnumMember 任一先行臂位」判定回递,命中落 error_type 并照常驻留 declared_type_links(.types 渲染 any 与基线一致) 2026-10-23 23:50:58 +08:00
cqh963852 5666c34a85 fix(checker): 别名符号型求值补 resolvedType 驻留闸——对齐 Go getTypeOfAlias(checker.go:19034-19056)valueSymbolLinks.resolvedType 一次求值永不重算语义(errorType/any 同样驻留):get_type_of_symbol 的 Alias 臂入口先读缓存命中即返,get_type_of_symbol_alias_inner 尾部 any 回落臂补驻留写回;未解析 import 别名族(es6/esnextmodulekindWithES5Target9 的 mod 五连导入)此前每次取型重走完整链(node_modules 上行走查+pattern ambient 全文件扫描+diagnostics 线性查重),驻留后每符号一次;镜像版 get_type_of_alias(mig/wc2_3.rs:517)本就带此闸但零调用者(死代码),活路径为自研链,本笔把同款闸装到活路径 2026-10-23 23:50:58 +08:00
cqh963852 b6e2473075 fix(checker): resolve_alias_base 补 aliasTarget 驻留——对齐 Go resolveAlias(checker.go:16679-16698)aliasSymbolLinks.aliasTarget 一次解析永不重解语义(未解析目标同样驻留):入口读缓存、完成/环上报后写缓存,仅别名链进行中的重入帧不读不写;失败语义保持符号自身(读者侧 ptr_eq 守卫已核);es6/esnextmodulekindWithES5Target9 的未解析 import 别名族由此每符号只解析一次,kill 分配死亡螺旋 2026-10-23 23:50:58 +08:00
cqh963852 b2e5503995 fix(checker): 未解析包名查 ambient 模块改 globals 查表——resolve_module_file_symbol_anchored 原先对非相对说明符做全程序逐文件逐语句线性扫描(O(全部语句)×每次别名解析),对齐 Go tryFindAmbientModule(checker.go:16459-16470)globals 带引号名查表语义,命中即 merged 符号返回;未命中照旧走 node_modules 向上查找 2026-10-23 23:49:52 +08:00
cqh963852 cad03ad505 fix(compile): check 期模块解析先查程序期解析记录——resolve_external_module_path 原先每次调用重建 Resolver(options.clone+全量 node_modules 走查),未解析 import 的 check 期反复查询即分配死亡螺旋的放大器;对齐 Go resolveExternalModuleNameWorker(checker.go:15527 经 program.GetResolvedModule,program.go:649-663)先查 resolved_modules 记录(program_2.rs:339-354 程序期已无条件入表含未解析条目):精确模式命中即定、无模式偏好按说明符名取已解析条目否则未解析、无记录才走原 resolver 兜底 2026-10-23 23:49:52 +08:00
cqh963852 c2567d3a88 fix(checker): 推断终化后清活动 mapper 实例化缓存——对齐 Go getInferredType 每条推断收尾的 c.clearActiveMapperCaches()(inference.go:1413):推断期活动 mapper 缓存的实例化产物随推断结果更新即过期,Go 显式失效;本仓 clear_active_mapper_caches 为死代码从未调用,active_type_mappers_caches 只进不清,Object.assign 系推断 × 条件型实例化风暴下驻留全量探索图(conditionalTypeDoesntSpinForever sig9 的留存放大器),并可能把过期实例化喂给后续解析 2026-10-23 23:49:46 +08:00
cqh963852 387060530f fix(checker): 条件型实例化 memo 随根共享,对齐 Go root.instantiations 生命周期——ConditionalRoot 克隆(new_conditional_type 收值、尾递归根切换、代入引擎重建)各开新指针,全局 thread_local 表按根指针分桶,每个延迟条件型副本独占空命名空间:自引用条件型(conditionalTypeDoesntSpinForever 的 BuildPubSubRecordType 六构造器互引用)重访永不命中 memo,重算随 storedAs/maxMs 双二路分支复利展开,表项永不清退钉住全部产物(worker signal 9 内存死亡螺旋);对齐 Go data.root = root 单根共享(checker.go:25818-25826)与 getConditionalTypeInstantiation 读写 root.instantiations(checker.go:23019-23044):instantiations 改 Arc<Mutex<HashMap<u64, Arc<Type>>>> 内嵌根上,derive Clone 全部副本同命名空间,删除 thread_local 旁表与 pool_reset 项,生命周期随 checker 型图自然终结 2026-10-23 23:49:46 +08:00
cqh963852 11c48f0490 fix(checker): 解析模式推导接 emit 视角格式——对齐 Go GetDefaultResolutionModeForFile/GetEmitModuleFormatOfFileWorker
Go getDefaultResolutionModeForFile(fileloader.go:1046-1052)的格式取
GetImpliedNodeFormatForEmitWorker(ast/utilities.go:2702-2717):node16 体系
用 implied 格式,其余仅在扩展名/package.json type 明确钉死时取值,模糊
plain .ts 为 None;getEmitSyntaxForUsageLocationWorker(fileloader.go:1096)
的 fileEmitMode 取 GetEmitModuleFormatOfFileWorker(utilities.go:2694-2700,
模糊时回落 emitModuleKind)。Rust 两处误接裸 implied_node_format_of_file
(package.json 视角,模糊 plain .ts 恒 CommonJS),bundler+esnext 程序下
推导出 CommonJS 而非 Go 的 ESNext:

- automaticTypeDirectiveResolutionBundler(FAIL):构建期记录
  (program_2.rs implied 格式键)+ checker 侧同源 CommonJS 推导使
  resolve_external_module/resolve_module_file_by_program_resolution 的
  GetResolvedModule 精确模式查询命中 CommonJS 条目(cjs.d.ts 的 default
  条件入口)而非 import 条件 esm.d.mts,PkgType 缺 esm 成员报 TS2353;
  对齐后 checker 模式为 ESNext,记录 miss 回落全量解析按 import 条件
  命中 esm.d.mts(构建期 implied 格式键偏离属 tsox-compile 既有缺口,
  本刀不触碰,checker 侧不再消费错键条目)

node16 体系两函数输出逐字节不变(node16 分支即 implied 格式;ES2020
is_non_node_esm 归 ESNext 同旧值),仅 exports/imports 解析开启的非
Node 系程序受影响
2026-10-23 23:46:48 +08:00
cqh963852 b80c31c68a fix(checker): ImportClause 别名臂改调节点基 get_target_of_module_default——对齐 Go getTargetOfImportClause
Go getTargetOfImportClause(checker.go:14814-14818)经 getTargetOfModuleDefault
(moduleSymbol, node, dontResolveAlias=true),canHaveSyntheticDefault 按 node
说明符取 usage 模式(两翼皆 ESM 无合成 default、node16 ESM→CJS 恒有合成
default,checker.go:15117-15146),判定上下文无关且与求值端
(typenode_import_query_checker.rs:410 同函数)一致。Rust 该臂原调
resolve_default_export_target_for 的 usage=None 变体,模式按 current_file
近似推导,检查期/发射期上下文漂移时与求值端分叉;resolve_alias_base 接
alias_target 驻留后首算冻结错值,引发四组回归:

- nodeModulesCjsFormatFileAlwaysHasDefault(4 变体):ESM→CJS 合成 default
  臂误判,mod 落 error
- nodeModulesTripleSlashReferenceModeDeclarationEmit7(4 变体+FAIL):
  obj2 落真实 default 成员 RequireInterface 而非模块符号 typeof obj2
- esmModeDeclarationFileWithExportAssignment:两翼皆 ESM 应无合成 default,
  误穿透 export= 得 example 函数
- impliedNodeFormatInterop1(FAIL):default import 落模块符号本体,
  属性访问报 TS2339

resolve_default_export_target_for 保留给 hover 调用方(非语料路径)
2026-10-23 23:46:48 +08:00
cqh963852 cd1dc0a4b0 fix(checker): resolve_alias_base 接 alias_target 读优先驻留——对齐 Go resolveAlias 缓存闸
Go resolveAlias(checker.go:16674-16698)经 aliasSymbolLinks.aliasTarget
每别名符号只解一次:已驻留即刻返回,未驻留才走 getTargetOfAliasDeclaration
全链并回填(含纯别名间接层 resolveIndirectionAlias 传递解析的最终目标)。
Rust resolve_alias_base 65 处调用点每次全链重走(resolve_alias_target →
resolve_import_alias_module → 快索引/记录查询 + resolve_module_member_symbol
深解),nodeModulesImportAttributesModeDeclarationEmit2(crash sig6)这类
声明发射下别名符号被显示链/类型查询反复触达的用例中放大分配。接线:

- 读优先命中(环检测栈之后):在飞符号环语义不变,中段写入的
  alias_target(NamespaceImport 臂克隆符号)不遮蔽环上报;已驻留目标
  (create_default_property_wrapper_for_module 合成 default、
  resolveESModuleSymbol 克隆)即刻返回——Go useResolvedLinks 臂同语义
- 完成路径回填最终目标(环参与方/解到自身不驻留),后续查询 O(1)
2026-10-23 23:46:48 +08:00
cqh963852 b4241b55a9 fix(checker): 深解链说明符解析接程序级解析记录——resolve_module_spec_from/resolve_package_symbol_from 快路径
同 bd5a95f 根因的递归面收口:resolve_module_member_symbol 深解(depth 8)
每层经 resolve_module_spec_from(相对臂兜底)与 resolve_package_symbol_from
(非相对臂)调 resolve_external_module_path 全量重解析(CompilerOptions
clone + 新建 Resolver + node_modules 搜索 + package.json JSON 重解析),
export * 再导链宽度下指数放大。Go 深解链(getTargetOfExportSpecifier →
resolveExternalModuleName → resolveExternalModule checker.go:15529)经
GetResolvedModule(program.go:649-656)查程序构建期解析记录;此处无
说明符节点可推 resolution-mode 覆盖,取已解析记录条目,miss 保留原盘上
解析与 node_modules 索引兜底
2026-10-23 23:46:02 +08:00
cqh963852 85f1b5f883 fix(checker): 模块符号解析三处接线程序级解析记录——对齐 Go GetResolvedModule 缓存闸
Go resolveExternalModule(checker.go:15529-15533)经 GetResolvedModule
(program.go:649-656)按(文件, 说明符, 模式)纯 map 查询程序构建期
fileloader 解析记录,checker 从不重跑模块解析;Rust 三处查询点每次都
resolve_external_module_path 全量重解析(每调用 clone 整份
CompilerOptions + 新建 Resolver + InMemoryFS 全套 node_modules 搜索 +
package.json JSON 重解析),nodeModulesImportAttributesModeDeclarationEmit2
(crash sig6 13.76s)这类 type-only import/export 声明带 resolution-mode
的用例下该路径高频进入,是分配死亡螺旋的主要放大面:

- r21k2_defs.rs resolve_external_module:mode 推导后先查
  get_recorded_module_resolutions 按 mode 精确匹配,未命中保留全量解析兜底
  (快索引命中不了 package.json exports/typings 入口形态,原注释声称查
  记录而实现未接线)
- checker_modules_checker_2.rs resolve_module_file_by_program_resolution
  (alias 解析 fallback 高频点):按声明说明符经 get_mode_for_usage_location
  同构建期口径推导 mode 查记录,兜底解析的 mode 由 None 改推导值
- typenode_import_query_checker.rs resolve_import_alias_target_symbol
  非相对说明符臂:记录型程序先按说明符 mode 查记录——同一说明符
  require/import 两模式各指向不同入口(require.d.ts/import.d.ts),
  原跨模式兜底解析会命中错误入口文件(mode=None 落 implied 模式),
  type-only require import 的别名目标因此误解析
2026-10-23 23:46:02 +08:00
cqh963852 a36aef5db8 fix(checker): import= 实体名别名目标解析单跳对齐 Go——resolve_alias_target 实体名分支去 0..4 自旋内联中继,getTargetOfImportEqualsDeclaration(checker.go:14731-14733)语义为 getSymbolOfPartOfRightHandSideOfImportEquals 单跳:实体名解析失败落 None(经 resolve_alias_base unwrap_or → OrElse unknownSymbol,checker.go:16692,memo 驻留),不再返回别名自身;纯别名中继交 resolve_alias_base is_pure_alias 分支递归(Go resolveIndirectionAlias checker.go:16690-16691,环检测/memo 同承)。dependencyViaImportAlias.ts 快检退回的 TS2437(target=A 自身泄漏出 unknownSymbol 闸外,targetFlags 级联)根因消除:import A = a.A 解析失败时 resolveAlias(A) 现落 memoized unknownSymbol,checkImportEqualsDeclaration 的 target != unknownSymbol 闸(checker.go:5646)恢复拦截 2026-10-23 23:45:55 +08:00
cqh963852 a7690921f2 fix(checker): import 别名解析对齐 Go resolveAlias 的 memo/unknownSymbol 语义——resolve_alias_base 补 aliasSymbolLinks.aliasTarget 驻留(含解析失败与环双路 memo unknownSymbol,checker.go:16678-16697 OrElse(target,unknown) 与环路径 16693-16696),斩断别名链无缓存重复全链展开(每次含 O(source_files) 模块名扫描与 node_modules 上爬探测);环命中/解析失败统一返回 unknownSymbol(原返回自身),getSymbol 链展开版 getSymbolFlags 接线 alias fallback(getSymbol checker.go:2251→getSymbolFlagsEx 链上失败别名 All 含义防级联;get_symbol_flags 函数体对齐 getSymbolFlagsEx checker.go:16771);mergeSymbol/resolveESModuleSymbol 两消费点补 unknownSymbol 短路回退(source/模块符号本体)。compiler/dependencyViaImportAlias.ts 等 import 别名链族 crash sig6 修复 2026-10-23 23:45:55 +08:00
cqh963852 c6589c962f fix(checker): 匿名对象回落实例化接 getObjectTypeInstantiation intern——组合 mapper 经 target 域驻留,restrictive/permissive 探测两侧产物恒同身份,definitelyTrue 直判消除 FooA 自引用名渲染链(checker.go:22846-22868);一代壳补映射域覆盖守卫(声明外层形参全覆盖才可复合恒等回 target) 2026-10-23 23:45:52 +08:00
cqh963852 06a3caeb6b docs(fixes): discriminatedUnionInference r2——FooA 自引用名渲染链消除结论与值级取证点
r1 后锚点 unknown→FooA(别名自身名),Go 期望 number。全文件唯一分歧。
本轮纯文本取证结论:
- Go 渲染判定基准:nodebuilderimpl.go:3529 别名名短路 = t.alias != nil 单门
  (协调方向提及的 getBaseTypeOfInstantiatedAlias/isTypeIdenticalTo/Deeply
  shadows 判定在本版 Go 不存在于该位);.types 通道(type_symbol_baseline.go:
  392-399)别名名呈现包成 TypeReferenceNode 非 Identifier,InTypeAlias 重渲染
  回退不触发,>FooA : number 是首渲染直出。
- Go alias 来源链:getConditionalType(checker.go:24872)对 check 型 Foo<number>
  急切解析,解析分支 result = instantiateType(trueType, trueMapper)
  (checker.go:24992)不挂 alias,alias 只挂 deferred 臂
  (checker.go:25001-25009)——解析成功即裸分支型。
- 本地:{FooA,[]} 全仓唯一产消点 alias_attach_for_type_reference +
  instantiate_alias_from_types_inner 附加门(:371-395),门与 Go 同构(deferred
  才挂);渲染位 alias 门(nodebuilder_checker_7.rs:412)与 .types 重渲染回退
  (types_baseline.rs:193-200)均对齐。消除结论:分歧唯一来源 =
  InferA<Foo<number>> 实例化的条件型解析未完成(substitute_infer_conditional
  → rebuild_deferred_conditional),重建 deferred 体被挂 {FooA,[]} 呈自引用名。
- 三个重建触发臂静态消除二臂(is_generic_top 恒 0;extends 非infer型参不可达),
  唯一未能排除臂 = resolve_conditional_type_with_check !definitely_true
  (restrictive 探测可赋值)——探测 Object 臂以 symbol+ANONYMOUS 为激活门,
  正是 r1 修复新近激活的路径。
- 列明 P1-P4 四个值级打印点(单例 verify 一次定臂)+ leftover 联合目标候选
  优先级淘汰规则对照(inference.go:184-195 vs 本地 infer_to_type_variable)。
- 本轮无代码变更,不回退 r1;第 3 轮按坐实臂修根因。
2026-10-23 23:45:52 +08:00
cqh963852 c18135911d fix(checker): substitute_infer_object 回落壳保留 object_flags 与 symbol——联合目标条件推断候选收集短路根因
匿名别名体实例化壳在 props 恒等(属性位替换无变化)仅签名返回位变化时落
Type::new 裸建壳分支,object_flags(Anonymous)与 symbol(TypeLiteral)双缺,
偏离 Go instantiateAnonymousType(checker.go:22985)恒保留语义;props 路径
(substitute_object_properties_deep)与 mapper 引擎(instantiate_anonymous_type)
均保留。后果:could_contain_type_variables_worker 对联合成员判假,联合目标
(FooBar<infer A> = Foo<infer A>|Bar<infer A>)整体判假,infer_from_types 入口
守卫直接短路,discriminatedUnionInference 的 FooA=InferA<Foo<number>> infer
形参零候选退化 unknown(Go 经 isTypeCloselyMatchedBy 同符号臂配对
Foo<number>~Foo<infer A> 推出 number)。补两字段后联合拆解、同符号配对、
候选登记全链恢复,详见 docs/fixes/discriminatedUnionInference.md
2026-10-23 23:45:52 +08:00
cqh963852 32cfa25a15 init: tsox 断史重根——自 main@85b4a87 断史快照,单根提交保留全部源码/工具/workflow 脚本;LFS 退役收尾(pre-push 钩子卸载,历史中段 data/*.csv LFS 指针随断史消除);data/ 数据产物全部 ignore 本地保留 2026-10-23 23:41:43 +08:00