@nudojs/core 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/dist/chunk-BU4A6XJ3.js +6856 -0
- package/dist/exec.d.ts +2 -0
- package/dist/exec.js +168 -0
- package/dist/index-CVYjXnwU.d.ts +902 -0
- package/dist/index.d.ts +953 -10
- package/dist/index.js +4489 -110
- package/package.json +33 -4
- package/CHANGELOG.md +0 -15
- package/src/__tests__/environment.test.ts +0 -48
- package/src/__tests__/ops-refined.test.ts +0 -194
- package/src/__tests__/ops.test.ts +0 -109
- package/src/__tests__/type-value-phase2.test.ts +0 -117
- package/src/__tests__/type-value-phase3.test.ts +0 -94
- package/src/__tests__/type-value-refined.test.ts +0 -210
- package/src/__tests__/type-value.test.ts +0 -213
- package/src/environment.ts +0 -69
- package/src/index.ts +0 -40
- package/src/ops.ts +0 -210
- package/src/refinements/index.ts +0 -2
- package/src/refinements/range.ts +0 -86
- package/src/refinements/template.ts +0 -178
- package/src/type-value.ts +0 -372
- package/tsconfig.json +0 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import { Node } from '@babel/types';
|
|
1
|
+
import { Node, File } from '@babel/types';
|
|
2
|
+
import { P as Phi, A as AstEnv, a as Abs, C as Confidence, b as Pred, S as Shape, c as PrimName, T as Term, R as RelSource, H as HofSite, L as LeakBudget } from './index-CVYjXnwU.js';
|
|
3
|
+
export { $ as $add, d as $arr, e as $async, f as $asyncReturn, g as $await, h as $call, i as $callNamed, j as $catchVal, k as $class, l as $concat, m as $div, n as $elems, o as $eq, p as $fnVal, q as $for, r as $forIter, s as $forOf, t as $fork, u as $ge, v as $gen, w as $get, x as $gt, y as $idx, z as $idxSet, B as $invoke, D as $invokeSuper, E as $join, F as $le, G as $len, I as $lit, J as $lt, K as $mod, M as $mul, N as $ne, O as $neg, Q as $new, U as $not, V as $obj, W as $optionalGet, X as $optionalInvoke, Y as $orDefault, Z as $set, _ as $setKey, a0 as $spread, a1 as $staticInvoke, a2 as $sub, a3 as $super, a4 as $switch, a5 as $thisGet, a6 as $thisSet, a7 as $throw, a8 as $typeof, a9 as $while, aa as $whileSeq, ab as $yield, ac as AbsAssignRecord, ad as AbsCallRecord, ae as AbsModuleExports, af as BCallRecord, ag as BClassSpec, ah as BMemberDiag, ai as DEFAULT_MAX_LOOP_ITERS, aj as EvalOptions, ak as EvalResult, al as HofCollectCtx, am as MAX_CALL_DEPTH, an as MAX_TOTAL_CALLS, ao as NudoThrow, ap as RunTranspiledOptions, aq as TranspileOptions, ar as TranspiledCallResult, as as abs, at as absToString, au as alphaOf, av as analyzeFn, aw as and, ax as anyVar, ay as app, az as applyAbsFn, aA as applyCallbackAbs, aB as asAbs, aC as asAbsVal, aD as betaOf, aE as bindImports, aF as bool, aG as boolLit, aH as callFunction, aI as callTranspiledExport, aJ as callTranspiledExportFull, aK as clearBClasses, aL as collectAbsExports, aM as collectAbsNodeTypes, aN as confJoin, aO as createHofCollectCtx, aP as currentExecPhi, aQ as defaultLeakBudget, aR as emptyEnv, aS as emptyPhi, aT as eq, aU as evalMethodBody, aV as evalNode, aW as evalProgramAbs, aX as evalSource, aY as exceedsBudget, aZ as findAbsAtPosition, a_ as ge, a$ as geNum, b0 as getAbsOrigin, b1 as getBCallCollector, b2 as getBClass, b3 as gt, b4 as gtNum, b5 as implies, b6 as instantiateReturn, b7 as isDefinitelyFalse, b8 as isDefinitelyTrue, b9 as isExactLit, ba as isNudoThrow, bb as isNumPrim, bc as isRelFn, bd as isStrPrim, be as le, bf as leNum, bg as leakIfNeeded, bh as lit, bi as litValue, bj as lt, bk as ltNum, bl as mapElementFallback, bm as maybeLeak, bn as ne, bo as never, bp as not, bq as noteMemberDispatchMiss, br as notePrimMemberMissing, bs as noteUnknownMemberMissing, bt as num, bu as numLit, bv as numVar, bw as obj, bx as or, by as pFalse, bz as pTrue, bA as phiAnd, bB as predEquals, bC as predToString, bD as predVars, bE as projectFlatMapResult, bF as promoteParamShape, bG as ptypeof, bH as recordMemberDiag, bI as registerBClass, bJ as resetAbsCallBudget, bK as resetLeakCounter, bL as runTranspiled, bM as setAbsAssignCollector, bN as setAbsCallCollector, bO as setAbsNodeCollector, bP as setAbsTruncationCollector, bQ as setApplyCallbackHost, bR as setBCallCollector, bS as setMemberDiagCollector, bT as shapeOfTerm, bU as shapeToString, bV as simplifyTerm, bW as snapshotAbs, bX as str, bY as strLit, bZ as substAbs, b_ as substPred, b$ as substPredAbs, c0 as tagAbsOrigin, c1 as termDepth, c2 as termEquals, c3 as termNodes, c4 as termToString, c5 as transpile, c6 as transpileExpression, c7 as transpileFile, c8 as transpileSource, c9 as tryPromoteDirectCall, ca as tryPromoteForOfIteratee, cb as tryPromoteHofCallback, cc as tryPromoteReceiverAsArr, cd as undefAbs, ce as unknown, cf as v, cg as withExecPhi, ch as withVar } from './index-CVYjXnwU.js';
|
|
2
4
|
|
|
3
5
|
type Environment = {
|
|
4
6
|
lookup(name: string): TypeValue;
|
|
5
7
|
bind(name: string, value: TypeValue): Environment;
|
|
6
8
|
update(name: string, value: TypeValue): boolean;
|
|
7
9
|
extend(bindings: Record<string, TypeValue>): Environment;
|
|
10
|
+
fork(): Environment;
|
|
8
11
|
has(name: string): boolean;
|
|
9
12
|
snapshot(): Environment;
|
|
10
13
|
getOwnBindings(): Record<string, TypeValue>;
|
|
11
14
|
};
|
|
12
15
|
declare function createEnvironment(parent?: Environment, bindings?: Map<string, TypeValue>): Environment;
|
|
13
16
|
|
|
14
|
-
type LiteralValue = string | number | boolean | null | undefined;
|
|
17
|
+
type LiteralValue = string | number | boolean | bigint | null | undefined;
|
|
18
|
+
type SigImpl = (args: TypeValue[], thisVal?: TypeValue) => TypeValue | undefined;
|
|
19
|
+
type FunctionSignature = {
|
|
20
|
+
paramTypes: TypeValue[];
|
|
21
|
+
returnType: TypeValue;
|
|
22
|
+
throwsType: TypeValue;
|
|
23
|
+
impl?: SigImpl;
|
|
24
|
+
};
|
|
15
25
|
type Refinement = {
|
|
16
26
|
name: string;
|
|
17
27
|
meta: Record<string, unknown>;
|
|
@@ -80,10 +90,21 @@ declare const T: {
|
|
|
80
90
|
readonly union: typeof createUnion;
|
|
81
91
|
readonly fn: (params: string[], body: Node, closure: Environment) => TypeValue;
|
|
82
92
|
readonly refine: (base: TypeValue, refinement: Refinement) => TypeValue;
|
|
93
|
+
readonly fnSig: (paramTypes: TypeValue[], returnType: TypeValue, throwsType?: TypeValue, impl?: SigImpl) => TypeValue;
|
|
83
94
|
};
|
|
84
95
|
declare function typeValueEquals(a: TypeValue, b: TypeValue): boolean;
|
|
85
96
|
declare function simplifyUnion(members: TypeValue[]): TypeValue;
|
|
86
97
|
declare function widenLiteral(tv: TypeValue): TypeValue;
|
|
98
|
+
/**
|
|
99
|
+
* union 成员全部为同原语基底的字面量且数量 > maxLiterals 时塌缩为该基类型;
|
|
100
|
+
* 非 union、混合类型、或数量不超限的原样返回。
|
|
101
|
+
*
|
|
102
|
+
* 复用 simplifyUnion(内含吸收律与去重):先让「基类型已在场」的字面量被吸收
|
|
103
|
+
* (3 | number → number),再对剩余的纯字面量联合做阈值坍缩(1|2|…|20 → number)。
|
|
104
|
+
* 两步不冲突也不重复:吸收只删基类型已在场的字面量,阈值坍缩只处理无基类型
|
|
105
|
+
* 在场的纯字面量联合。
|
|
106
|
+
*/
|
|
107
|
+
declare function collapseLiteralUnion(tv: TypeValue, maxLiterals: number): TypeValue;
|
|
87
108
|
declare function isSubtypeOf(a: TypeValue, b: TypeValue): boolean;
|
|
88
109
|
declare function deepCloneTypeValue(tv: TypeValue, idMap?: Map<symbol, symbol>): TypeValue;
|
|
89
110
|
declare function mergeObjectProperties(a: TypeValue & {
|
|
@@ -96,32 +117,46 @@ declare function narrowType(tv: TypeValue, predicate: (member: TypeValue) => boo
|
|
|
96
117
|
declare function subtractType(tv: TypeValue, predicate: (member: TypeValue) => boolean): TypeValue;
|
|
97
118
|
declare function getPrimitiveTypeOf(tv: TypeValue): string | undefined;
|
|
98
119
|
declare function getRefinedBase(tv: TypeValue): TypeValue;
|
|
120
|
+
declare function isFnSig(tv: TypeValue): boolean;
|
|
121
|
+
declare function getFnSig(tv: TypeValue): FunctionSignature | undefined;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 残差 IR 兜底(不是类型运算真理源)。
|
|
125
|
+
*
|
|
126
|
+
* 真理在 algebra:算术/比较/相等/typeof/!/−/字符串词法序/nullish 均走 Abs。
|
|
127
|
+
* 这里只保留:
|
|
128
|
+
* - add:代数拒绝时的混合 `+`
|
|
129
|
+
* - 比较/相等:代数无法判定时的保守 boolean / 字面量折叠
|
|
130
|
+
* - dispatchMethod/Property:宿主 refined 扩展(startsWith、length…)
|
|
131
|
+
*/
|
|
99
132
|
|
|
100
133
|
declare const Ops: {
|
|
101
134
|
readonly add: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
102
|
-
readonly sub: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
103
|
-
readonly mul: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
104
|
-
readonly div: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
105
|
-
readonly mod: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
106
135
|
readonly strictEq: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
107
136
|
readonly strictNeq: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
108
137
|
readonly gt: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
109
138
|
readonly lt: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
110
139
|
readonly gte: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
111
140
|
readonly lte: (left: TypeValue, right: TypeValue) => TypeValue;
|
|
112
|
-
readonly typeof_: (operand: TypeValue) => TypeValue;
|
|
113
141
|
readonly not: (operand: TypeValue) => TypeValue;
|
|
114
|
-
readonly neg: (operand: TypeValue) => TypeValue;
|
|
115
142
|
};
|
|
116
143
|
declare function applyBinaryOp(op: string, left: TypeValue, right: TypeValue): TypeValue;
|
|
117
144
|
declare function dispatchBinaryOp(op: string, left: TypeValue, right: TypeValue): TypeValue;
|
|
118
145
|
declare function dispatchMethod(receiver: TypeValue, name: string, args: TypeValue[]): TypeValue | undefined;
|
|
119
146
|
declare function dispatchProperty(receiver: TypeValue, name: string): TypeValue | undefined;
|
|
120
147
|
|
|
148
|
+
/**
|
|
149
|
+
* 模板字面量谓词,独立于 template.ts 以断开运行时循环引用:
|
|
150
|
+
* type-value.ts(联合吸收律)与 template.ts 都依赖本模块,而本模块对
|
|
151
|
+
* type-value.ts 只有 `import type` 边(编译后消失),运行时依赖保持单向
|
|
152
|
+
* type-value.ts / template.ts -> template-predicates.ts。
|
|
153
|
+
*/
|
|
154
|
+
declare function isTemplate(tv: TypeValue): boolean;
|
|
155
|
+
|
|
121
156
|
declare function getKnownPrefix(parts: TypeValue[]): string;
|
|
122
157
|
declare function getKnownSuffix(parts: TypeValue[]): string;
|
|
123
158
|
declare function createTemplate(parts: TypeValue[]): TypeValue;
|
|
124
|
-
|
|
159
|
+
|
|
125
160
|
declare function getTemplateParts(tv: TypeValue): TypeValue[] | undefined;
|
|
126
161
|
declare function concatTemplates(left: TypeValue, right: TypeValue): TypeValue;
|
|
127
162
|
|
|
@@ -134,4 +169,912 @@ declare function createRange(meta: RangeMeta): TypeValue;
|
|
|
134
169
|
declare function isRange(tv: TypeValue): boolean;
|
|
135
170
|
declare function getRangeMeta(tv: TypeValue): RangeMeta | undefined;
|
|
136
171
|
|
|
137
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Nudo Mock 帮助函数
|
|
174
|
+
*
|
|
175
|
+
* 提供类型安全的 mock 创建,替代 sinon 表达式
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
type MockHelper = {
|
|
179
|
+
kind: "mock-helper";
|
|
180
|
+
returnValue?: TypeValue;
|
|
181
|
+
resolvedValue?: TypeValue;
|
|
182
|
+
rejectedValue?: TypeValue;
|
|
183
|
+
implementation?: (...args: TypeValue[]) => TypeValue;
|
|
184
|
+
onFirstCallValue?: TypeValue;
|
|
185
|
+
onSecondCallValue?: TypeValue;
|
|
186
|
+
withArgsCases?: {
|
|
187
|
+
args: TypeValue[];
|
|
188
|
+
returnValue: TypeValue;
|
|
189
|
+
}[];
|
|
190
|
+
callsFakeImpl?: TypeValue;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* 创建一个 stub mock
|
|
194
|
+
* 用法: @nudo:mock fetch = stub()
|
|
195
|
+
*/
|
|
196
|
+
declare function stub(): MockHelper;
|
|
197
|
+
declare namespace stub {
|
|
198
|
+
var returns: (value: TypeValue) => MockHelper;
|
|
199
|
+
var resolves: (value: TypeValue) => MockHelper;
|
|
200
|
+
var rejects: (value: TypeValue) => MockHelper;
|
|
201
|
+
var onFirstCall: (value: TypeValue) => MockHelper;
|
|
202
|
+
var onSecondCall: (value: TypeValue) => MockHelper;
|
|
203
|
+
var withArgs: (...args: TypeValue[]) => MockHelper;
|
|
204
|
+
var callsFake: (fn: TypeValue) => MockHelper;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* 创建一个 spy mock
|
|
208
|
+
* 用法: @nudo:mock handler = spy()
|
|
209
|
+
*/
|
|
210
|
+
declare function spy(): MockHelper;
|
|
211
|
+
declare namespace spy {
|
|
212
|
+
var returns: (value: TypeValue) => MockHelper;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* 创建一个 mock
|
|
216
|
+
* 用法: @nudo:mock service = mock()
|
|
217
|
+
*/
|
|
218
|
+
declare function mock(): MockHelper;
|
|
219
|
+
/**
|
|
220
|
+
* 将 MockHelper 转换为 TypeValue
|
|
221
|
+
*/
|
|
222
|
+
declare function mockHelperToTypeValue(helper: MockHelper, env: Environment): TypeValue;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* 原地剥除 AST 中的 TS-only 语法节点/字段,返回同一棵 AST(便于链式使用)。
|
|
226
|
+
* 不改写任何 loc/start/end;语句删除只影响所在数组,不重排兄弟节点。
|
|
227
|
+
*/
|
|
228
|
+
declare function stripTypes<T extends Node>(ast: T): T;
|
|
229
|
+
|
|
230
|
+
declare function resetParseSourceCache(): void;
|
|
231
|
+
declare function getParseSourceCacheSize(): number;
|
|
232
|
+
declare function parseSource(source: string, opts?: {
|
|
233
|
+
errorRecovery?: boolean;
|
|
234
|
+
}): File;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* 路径约束栈(Φ)。
|
|
238
|
+
*
|
|
239
|
+
* Φ 是当前控制流路径上的合取前提。代数运算(add/cmp/…)读取它做单调传播;
|
|
240
|
+
* evaluator 在 if 守卫处 push/pop。栈属于类型系统,不属于 host CLI。
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
declare function currentPhi(): Phi;
|
|
244
|
+
declare function pushPhi(p: Phi): void;
|
|
245
|
+
declare function popPhi(): void;
|
|
246
|
+
declare function resetPhi(): void;
|
|
247
|
+
/** 在当前 Φ 上合取额外约束,body 结束后恢复 */
|
|
248
|
+
declare function withPhiConstraint(extra: Phi, body: () => void): void;
|
|
249
|
+
declare function describePhi(): string;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Abs 上的一等函数:shape 是 fn,实现在旁路(不污染 Shape)。
|
|
253
|
+
* 与 term-registry 同一纪律:不给共享单例挂 impl。
|
|
254
|
+
*/
|
|
255
|
+
|
|
256
|
+
type AbsFnImpl = {
|
|
257
|
+
params: string[];
|
|
258
|
+
/** 可选:无 body 时走 relation(纯关系 fn) */
|
|
259
|
+
body?: Node;
|
|
260
|
+
async?: boolean;
|
|
261
|
+
/** 声明时捕获的环境(闭包) */
|
|
262
|
+
env?: AstEnv;
|
|
263
|
+
kind?: string;
|
|
264
|
+
/** 调用时直接派发(mock withArgs 等),优先于 body */
|
|
265
|
+
apply?: (args: Abs[]) => Abs;
|
|
266
|
+
/**
|
|
267
|
+
* Optional content key for cache fingerprints. formatAbs cannot see
|
|
268
|
+
* WeakMap-side mock semantics (returns/withArgs/callsFake), so hosts that
|
|
269
|
+
* build mocks should stamp a stable fingerprint here.
|
|
270
|
+
* relation-only 必填(未传时 relationFn 自动生成)。
|
|
271
|
+
*/
|
|
272
|
+
fingerprint?: string;
|
|
273
|
+
/** 无 body 时,按 paramTypes 做 α 替换得到返回 */
|
|
274
|
+
relation?: {
|
|
275
|
+
paramTypes: Abs[];
|
|
276
|
+
returnType: Abs;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
declare function attachFnImpl(a: Abs, impl: AbsFnImpl): void;
|
|
280
|
+
declare function getFnImpl(a: Abs): AbsFnImpl | undefined;
|
|
281
|
+
/** 造一个带实现的 Abs 函数值 */
|
|
282
|
+
declare function absFunction(params: string[], impl: Omit<AbsFnImpl, "params">): Abs;
|
|
283
|
+
/** relationFn 稳定 fingerprint(同签名共享,见 §3.3 已知限制) */
|
|
284
|
+
declare function relationFingerprint(paramTypes: Abs[], returnType: Abs): string;
|
|
285
|
+
/**
|
|
286
|
+
* 无 body、纯关系的 fn Abs。params 仅记 arity。
|
|
287
|
+
*
|
|
288
|
+
* **双写纪律:** 同一份关系数据必须同时写到——
|
|
289
|
+
* 1. `shape.paramTypes` / `shape.returnType` —— format / leq / 展示读这里
|
|
290
|
+
* 2. `impl.relation` —— D 路径应用读这里
|
|
291
|
+
* 两槽共享同一数组/对象引用(防内容分叉);构造后请勿原地 mutate。
|
|
292
|
+
*
|
|
293
|
+
* 默认 conf="path"(与提升产物一致)。禁止静默对齐 absFunction 的 "exact"。
|
|
294
|
+
* fingerprint 必填(call-budget);未传时由 paramTypes+returnType 稳定序列化生成。
|
|
295
|
+
* 同签名 relationFn 共享 fingerprint → 共享 budget 键(见 design §3.3 已知限制)。
|
|
296
|
+
*/
|
|
297
|
+
declare function relationFn(paramTypes: Abs[], returnType: Abs, opts?: {
|
|
298
|
+
params?: string[];
|
|
299
|
+
conf?: Confidence;
|
|
300
|
+
fingerprint?: string;
|
|
301
|
+
}): Abs;
|
|
302
|
+
/** 仅写 shape 槽(E 路径 / §5.2 提升产物);禁止 attachFnImpl */
|
|
303
|
+
declare function shapeOnlyFn(paramTypes: Abs[], returnType: Abs, opts?: {
|
|
304
|
+
params?: string[];
|
|
305
|
+
conf?: Confidence;
|
|
306
|
+
}): Abs;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* 算术核:单调性 + 常量折叠 + 约束传播。
|
|
310
|
+
* 这是「类型即计算」的主武器——x>0 时 x+1 必须得到 >1。
|
|
311
|
+
*/
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* 抽象加法:eval(a + b) —— 跟真实 JS,不无根据地假定 number。
|
|
315
|
+
* 1. 双方字面量 → 直接求值
|
|
316
|
+
* 2. 双方 number prim → term + 单调性 pred,shape=number
|
|
317
|
+
* 3. 含 string/template → 拼接
|
|
318
|
+
* 4. any / type-var 参与 → 按 JS + 的可能结果取并集:number | string
|
|
319
|
+
* (bool/null 走 ToNumber→number;object 默认 ToPrimitive→string;
|
|
320
|
+
* bigint/symbol 边角不在默认并集里,由调用点实例化再收窄)
|
|
321
|
+
* 无契约的 score(x){return x+1}:score("x") 合法,不得钉成 number。
|
|
322
|
+
*/
|
|
323
|
+
declare function add(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
324
|
+
type NumBounds = {
|
|
325
|
+
lo?: {
|
|
326
|
+
value: number;
|
|
327
|
+
strict: boolean;
|
|
328
|
+
};
|
|
329
|
+
hi?: {
|
|
330
|
+
value: number;
|
|
331
|
+
strict: boolean;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* 提取 Abs 上相对 term 的数值界。
|
|
336
|
+
* 优先用自身 pred;否则查 Φ(针对 var id)。
|
|
337
|
+
*/
|
|
338
|
+
declare function numericBounds(a: Abs, phi?: Phi): NumBounds | undefined;
|
|
339
|
+
/** 减法:a - b = a + (-b),数值上做单调性 */
|
|
340
|
+
declare function sub(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
341
|
+
/** 乘法:字面量直接求值;×正数同向缩放;×负数翻转不等式;×0 归零 */
|
|
342
|
+
declare function mul(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
343
|
+
/**
|
|
344
|
+
* 除法:字面量折叠;除以正/负常数时按单调性推界。
|
|
345
|
+
* 除以 0:JS 语义为 ±Infinity / NaN,shape 仍 number(不报违例)。
|
|
346
|
+
*/
|
|
347
|
+
declare function div(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
348
|
+
/**
|
|
349
|
+
* 取模:字面量折叠;`x % k`(k>0 字面量)结果界在 (−|k|, |k|)。
|
|
350
|
+
* 整数模可收紧到 [0, k),此处先做保守实数界。
|
|
351
|
+
*/
|
|
352
|
+
declare function mod(a: Abs, b: Abs, phi?: Phi): Abs;
|
|
353
|
+
/** 比较:返回 boolean Abs;若双字面量则 exact */
|
|
354
|
+
declare function cmp(op: "lt" | "le" | "gt" | "ge" | "eq" | "ne", a: Abs, b: Abs, phi?: Phi): Abs;
|
|
355
|
+
/** 从比较结果 Abs 提取「若为真」的额外约束(供 if 使用) */
|
|
356
|
+
declare function trueConstraint(c: Abs): Pred | undefined;
|
|
357
|
+
declare function falseConstraint(c: Abs): Pred | undefined;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* 语言表面运算(仍在 Abs 上):typeof / 一元- / ! / nullish 相等。
|
|
361
|
+
* 类型即计算——一元与控制流判定与二元算术同一运算域。
|
|
362
|
+
*/
|
|
363
|
+
|
|
364
|
+
/** JS typeof:结果域永远是 string */
|
|
365
|
+
declare function typeofAbs(a: Abs): Abs;
|
|
366
|
+
/** 一元负号:字面量折叠;符号数翻转不等式 */
|
|
367
|
+
declare function negAbs(a: Abs, _phi?: Phi): Abs;
|
|
368
|
+
/** 逻辑非 */
|
|
369
|
+
declare function notAbs(a: Abs): Abs;
|
|
370
|
+
/** 该 shape 在 JS 上一定不是 null/undefined */
|
|
371
|
+
declare function definitelyNotNullishShape(s: Shape): boolean;
|
|
372
|
+
declare function isNullishLitAbs(a: Abs): boolean;
|
|
373
|
+
/**
|
|
374
|
+
* 严格相等(Abs):双字面量折叠;nullish 与 definitely-not-nullish → false。
|
|
375
|
+
* 返回 undefined = 无法判定(交给 boolean + 调用方)。
|
|
376
|
+
*/
|
|
377
|
+
declare function strictEqAbs(a: Abs, b: Abs): boolean | undefined;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Abs 侧常用 builtin:shape 级运算,不依赖 TypeValue host 库。
|
|
381
|
+
* 覆盖 Math / Object / JSON / Number / 全局转换函数的常见面。
|
|
382
|
+
*/
|
|
383
|
+
|
|
384
|
+
/** Math.* — 字面量可折叠的返回精确值,否则 number */
|
|
385
|
+
declare function evalMathMethod(name: string, args: Abs[]): Abs | undefined;
|
|
386
|
+
/** Object.keys/values/entries/assign */
|
|
387
|
+
declare function evalObjectMethod(name: string, args: Abs[]): Abs | undefined;
|
|
388
|
+
/** JSON.parse / stringify */
|
|
389
|
+
declare function evalJsonMethod(name: string, args: Abs[]): Abs | undefined;
|
|
390
|
+
/** Number.isInteger / isNaN / parseFloat 等 */
|
|
391
|
+
declare function evalNumberStatic(name: string, args: Abs[]): Abs | undefined;
|
|
392
|
+
/** 全局 parseInt / parseFloat / isNaN / Number / String / Boolean */
|
|
393
|
+
declare function evalGlobalFn(name: string, args: Abs[]): Abs | undefined;
|
|
394
|
+
/** Array.isArray / Array.from / Array.of */
|
|
395
|
+
declare function evalArrayStatic(name: string, args: Abs[]): Abs | undefined;
|
|
396
|
+
/** new Date() / Date.now / date.getTime */
|
|
397
|
+
declare function evalDateCtor(args: Abs[]): Abs;
|
|
398
|
+
declare function evalDateStatic(name: string, _args: Abs[]): Abs | undefined;
|
|
399
|
+
declare function evalDateMethod(name: string, _recv: Abs, _args: Abs[]): Abs | undefined;
|
|
400
|
+
/** new RegExp / regexp.test / exec */
|
|
401
|
+
declare function evalRegExpCtor(_args: Abs[]): Abs;
|
|
402
|
+
declare function evalRegExpMethod(name: string, _recv: Abs, _args: Abs[]): Abs | undefined;
|
|
403
|
+
/** Promise:new Promise / Promise.resolve / reject / all */
|
|
404
|
+
declare function evalPromiseCtor(_args: Abs[]): Abs;
|
|
405
|
+
declare function evalPromiseStatic(name: string, args: Abs[]): Abs | undefined;
|
|
406
|
+
/** 命名空间分派入口 */
|
|
407
|
+
declare function evalNamespaceCall(ns: string, method: string, args: Abs[]): Abs | undefined;
|
|
408
|
+
/** new X(...) */
|
|
409
|
+
declare function evalBuiltinNew(className: string, args: Abs[]): Abs | undefined;
|
|
410
|
+
/** brand 实例方法(Date/RegExp/Map/Set) */
|
|
411
|
+
declare function evalBuiltinInstanceMethod(brandName: string, method: string, recv: Abs, args: Abs[]): Abs | undefined;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Abs 方法表:模板字符串 / 结构值上的方法与属性。
|
|
415
|
+
* 类型即计算——方法结果仍是 Abs,可继续参与约束推理。
|
|
416
|
+
* 宿主 TypeValue 的 dispatchMethod 只服务 IR 兜底,不是真理源。
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* 调用 Abs 方法。返回 undefined = 未接管(调用方走其它路径)。
|
|
421
|
+
*/
|
|
422
|
+
declare function callAbsMethod(recv: Abs, name: string, args: Abs[]): Abs | undefined;
|
|
423
|
+
/** 属性读取:template/string.length 等 */
|
|
424
|
+
declare function getAbsProperty(recv: Abs, name: string): Abs | undefined;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* 结构层:对象槽位、spread、函数重载并。
|
|
428
|
+
* 纪律:积之和默认;optional 塌缩是显式损失;函数并保输入→输出相关性。
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
type Slot = {
|
|
432
|
+
value: Abs;
|
|
433
|
+
optional?: boolean;
|
|
434
|
+
readonly?: boolean;
|
|
435
|
+
};
|
|
436
|
+
type ObjShape = {
|
|
437
|
+
k: "obj";
|
|
438
|
+
slots: Record<string, Slot>;
|
|
439
|
+
index?: {
|
|
440
|
+
key: Abs;
|
|
441
|
+
value: Abs;
|
|
442
|
+
};
|
|
443
|
+
open?: boolean;
|
|
444
|
+
};
|
|
445
|
+
declare function objOf(slots: Record<string, Slot>, opts?: {
|
|
446
|
+
index?: {
|
|
447
|
+
key: Abs;
|
|
448
|
+
value: Abs;
|
|
449
|
+
};
|
|
450
|
+
open?: boolean;
|
|
451
|
+
}): Abs;
|
|
452
|
+
declare function isObj(a: Abs): a is Abs & {
|
|
453
|
+
shape: ObjShape;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* spread:base ⊕ over(右侧覆盖,不是 join)
|
|
457
|
+
* 未出现在 over 的 key 保留 base;over 的 key 覆盖。
|
|
458
|
+
*/
|
|
459
|
+
declare function spread(base: Abs, over: Abs): Abs;
|
|
460
|
+
/**
|
|
461
|
+
* 对象 join:默认积之和(sum),不自动折 optional。
|
|
462
|
+
* 同 key 集:槽位级 join(字面量并);异 key 集:保持 sum。
|
|
463
|
+
*/
|
|
464
|
+
declare function joinObjects(a: Abs, b: Abs): Abs;
|
|
465
|
+
/** 值级 join:字面量保留为… Phase A 对 prim 做 term 保留策略 */
|
|
466
|
+
declare function joinValues(a: Abs, b: Abs): Abs;
|
|
467
|
+
declare function makeSum(a: Abs, b: Abs): Abs;
|
|
468
|
+
/**
|
|
469
|
+
* 显式损失:sum-of-products → optional 槽(仅 emit/阈值)。
|
|
470
|
+
* 强制 #widened。
|
|
471
|
+
*/
|
|
472
|
+
declare function collapseToOptional(sum: Abs): Abs;
|
|
473
|
+
type FnAbs = Abs & {
|
|
474
|
+
shape: {
|
|
475
|
+
k: "fn";
|
|
476
|
+
params: string[];
|
|
477
|
+
name?: string;
|
|
478
|
+
/** 外延参数类型(若已知) */
|
|
479
|
+
paramTypes?: Abs[];
|
|
480
|
+
/** 外延返回类型 */
|
|
481
|
+
returnType?: Abs;
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
declare function fnOf(params: string[], name?: string): Abs;
|
|
485
|
+
/**
|
|
486
|
+
* 函数 join:签名并(重载),禁止 (A|C)→(B|D)。
|
|
487
|
+
*/
|
|
488
|
+
declare function joinFunctions(a: Abs, b: Abs): Abs;
|
|
489
|
+
/** 通用 join:分派到对象/函数/值 */
|
|
490
|
+
declare function joinAbs(a: Abs, b: Abs): Abs;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* 结构可赋值:src ≤ tgt(Abs 上的 leq)。
|
|
494
|
+
*
|
|
495
|
+
* 规则与 TS 结构子类型同构,但作用在推断出的 Abs 上:
|
|
496
|
+
* - 对象宽度 + 深度;optional 可缺
|
|
497
|
+
* - brand 名义;fn 参数逆变、返回协变
|
|
498
|
+
* - pred:src 蕴含 tgt(更严的值可赋给更宽的目标)
|
|
499
|
+
*
|
|
500
|
+
* 不是完备 checker 的替代——是 Abs 之间的兼容判定。
|
|
501
|
+
*/
|
|
502
|
+
|
|
503
|
+
type LeqResult = {
|
|
504
|
+
ok: boolean;
|
|
505
|
+
/** Nudo 式原因(actual ⊭ target),不是 TS 文案 */
|
|
506
|
+
reason?: string;
|
|
507
|
+
};
|
|
508
|
+
/**
|
|
509
|
+
* src 可赋给 tgt。
|
|
510
|
+
* phi:路径前提(可选);env:用于 brand 继承链。
|
|
511
|
+
*/
|
|
512
|
+
declare function leqAbs(src: Abs, tgt: Abs, opts?: {
|
|
513
|
+
phi?: Phi;
|
|
514
|
+
env?: AstEnv;
|
|
515
|
+
}): LeqResult;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* 格式化:把 Abs 渲染成人类可读 / CLI 友好的字符串。
|
|
519
|
+
*/
|
|
520
|
+
|
|
521
|
+
type FormatOptions = {
|
|
522
|
+
/** 是否显示 term= */
|
|
523
|
+
showTerm?: boolean;
|
|
524
|
+
/** 是否显示 pred */
|
|
525
|
+
showPred?: boolean;
|
|
526
|
+
indent?: string;
|
|
527
|
+
};
|
|
528
|
+
declare function formatAbs(a: Abs, opts?: FormatOptions): string;
|
|
529
|
+
/** fn/arr 槽位:shape + 非 lit term(禁止在 format 里内联复制 term 逻辑) */
|
|
530
|
+
declare function formatShapeSlot(a: Abs): string;
|
|
531
|
+
declare function formatShape(a: Abs): string;
|
|
532
|
+
/** 多行展示,CLI 用 */
|
|
533
|
+
declare function formatAbsMultiline(a: Abs, label?: string): string;
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* 约束模板构建器(参数无关)。
|
|
537
|
+
*
|
|
538
|
+
* number().gt(0) → 占位项 self 上的 Pred
|
|
539
|
+
* number().int().ge(0) → 整数 + 下界
|
|
540
|
+
* string().min(1) → 非空串(长度)
|
|
541
|
+
* array(number().gt(0)) → 元素约束
|
|
542
|
+
* shape({ id: number().gt(0) }) → object 形状约束
|
|
543
|
+
* instantiate("ms") → Pred ms > 0 / u.id > 0 ∧ …
|
|
544
|
+
*
|
|
545
|
+
* 在 *.nudo.js 里执行;不是 zod 绑定,是我们自己的运行时 API。
|
|
546
|
+
* 不需要 interface/type 语法——契约用 JS 表达式声明。
|
|
547
|
+
*/
|
|
548
|
+
|
|
549
|
+
/** 模板占位项;instantiate 时换成真实参数名 */
|
|
550
|
+
declare const SELF = "__nudo_self__";
|
|
551
|
+
/** 字段访问项:u.id */
|
|
552
|
+
declare function getTerm(obj: Term, key: string): Term;
|
|
553
|
+
/** 长度项:length(u) */
|
|
554
|
+
declare function lenTerm(t: Term): Term;
|
|
555
|
+
type NudoField = {
|
|
556
|
+
constraint: NudoConstraint;
|
|
557
|
+
optional?: boolean;
|
|
558
|
+
};
|
|
559
|
+
type NudoConstraint = {
|
|
560
|
+
readonly __nudoConstraint: true;
|
|
561
|
+
readonly prim?: PrimName;
|
|
562
|
+
readonly preds: Pred[];
|
|
563
|
+
/** object 形状:字段名 → 嵌套约束 */
|
|
564
|
+
readonly fields?: Record<string, NudoField>;
|
|
565
|
+
/** array 元素约束 */
|
|
566
|
+
readonly element?: NudoConstraint;
|
|
567
|
+
/** 整数(number 链式 .int()) */
|
|
568
|
+
readonly int?: boolean;
|
|
569
|
+
/** 该约束整体可选(shape 字段用;不用 optional 以免与链式方法撞名) */
|
|
570
|
+
readonly isOptional?: boolean;
|
|
571
|
+
};
|
|
572
|
+
declare function isNudoConstraint(x: unknown): x is NudoConstraint;
|
|
573
|
+
/** 链式约束:不可变,每次 .gt() 返回新对象 */
|
|
574
|
+
type ConstraintBuilder = NudoConstraint & {
|
|
575
|
+
gt(n: number): ConstraintBuilder;
|
|
576
|
+
ge(n: number): ConstraintBuilder;
|
|
577
|
+
lt(n: number): ConstraintBuilder;
|
|
578
|
+
le(n: number): ConstraintBuilder;
|
|
579
|
+
/** number:要求整数 */
|
|
580
|
+
int(): ConstraintBuilder;
|
|
581
|
+
/** string:长度下界 */
|
|
582
|
+
min(n: number): ConstraintBuilder;
|
|
583
|
+
/** string:长度上界 */
|
|
584
|
+
max(n: number): ConstraintBuilder;
|
|
585
|
+
/** string:精确长度 */
|
|
586
|
+
length(n: number): ConstraintBuilder;
|
|
587
|
+
/** 字段可选(仅在 shape 内有意义) */
|
|
588
|
+
optional(): ConstraintBuilder;
|
|
589
|
+
};
|
|
590
|
+
/** number() —— 约束 number 原语 + 后续链式界 */
|
|
591
|
+
declare function number(): ConstraintBuilder;
|
|
592
|
+
declare function string(): ConstraintBuilder;
|
|
593
|
+
declare function boolean(): ConstraintBuilder;
|
|
594
|
+
/** array(item) —— 数组,元素满足 item */
|
|
595
|
+
declare function array(item: NudoConstraint | ConstraintBuilder): ConstraintBuilder;
|
|
596
|
+
/**
|
|
597
|
+
* object 形状约束(契约规范形状,无需 interface):
|
|
598
|
+
*
|
|
599
|
+
* shape({ id: number().gt(0), name: string() })
|
|
600
|
+
*/
|
|
601
|
+
declare function shape(fields: Record<string, NudoConstraint | ConstraintBuilder>): ConstraintBuilder;
|
|
602
|
+
/** 把模板绑定到参数名:self → paramName;shape 展开为字段访问 Pred */
|
|
603
|
+
declare function instantiateConstraint(c: NudoConstraint, paramName: string): Pred;
|
|
604
|
+
/**
|
|
605
|
+
* 契约 → 函数入口 param Abs(infer/hover 用)。
|
|
606
|
+
* 标量:prim + pred;shape:obj slots 递归。
|
|
607
|
+
*/
|
|
608
|
+
declare function constraintToEntryAbs(c: NudoConstraint, paramName: string): Abs;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* 精化契约解析:唯一形态
|
|
612
|
+
*
|
|
613
|
+
* @nudo:refine <param> <constraint> 参数精化(挂入口 Abs,参与运算)
|
|
614
|
+
* @nudo:refine return <constraint> 返回精化(推断返回值 ⊭ 时红)
|
|
615
|
+
*
|
|
616
|
+
* 不叫 requires:那只是「校验挡板」。
|
|
617
|
+
* refine 表示约束是类型的一部分——Abs = shape × term × **pred** × conf,
|
|
618
|
+
* pred 会流入代数(x>0 ⇒ x+1>1),不只是调用点挡一下。
|
|
619
|
+
*
|
|
620
|
+
* constraint 来自 *.nudo.js 导出的模板(number().gt(0) 等),
|
|
621
|
+
* 由 /// @nudo:import { delay } from "./delay.nudo.js" 引入。
|
|
622
|
+
* 不支持写 `x > 0`(绑死参数名)。
|
|
623
|
+
* 不用 JSDoc @param/@return:那是类型注解语法。
|
|
624
|
+
*/
|
|
625
|
+
|
|
626
|
+
/** `/// @nudo:import { delay, percent } from "./delay.nudo.js"` */
|
|
627
|
+
type NamedImport = {
|
|
628
|
+
names: string[];
|
|
629
|
+
spec: string;
|
|
630
|
+
};
|
|
631
|
+
declare function extractNudoImports(source: string): NamedImport[];
|
|
632
|
+
/**
|
|
633
|
+
* 执行 *.nudo.js(真实 JS + 我们的构建器)。
|
|
634
|
+
* 把 export const 改写成 const,末尾 return { names }。
|
|
635
|
+
*/
|
|
636
|
+
declare function execNudoModule(src: string): Record<string, unknown>;
|
|
637
|
+
type RefineResolveOpts = {
|
|
638
|
+
loadModule?: (spec: string, fromFile: string) => string | undefined;
|
|
639
|
+
fromFile?: string;
|
|
640
|
+
};
|
|
641
|
+
declare function resetNudoModuleExecCache(): void;
|
|
642
|
+
/**
|
|
643
|
+
* 解析 `ms delay` / `n percent` → [param, Pred]
|
|
644
|
+
* 多条用 && 或换行连接。
|
|
645
|
+
* 同时保留原始 NudoConstraint(shape 字段检查用)。
|
|
646
|
+
*/
|
|
647
|
+
type RefineEntry = {
|
|
648
|
+
param: string;
|
|
649
|
+
pred: Pred;
|
|
650
|
+
constraint: NudoConstraint;
|
|
651
|
+
};
|
|
652
|
+
declare function extractRefinesFromSource(source: string, fnName: string, opts?: RefineResolveOpts): RefineEntry[];
|
|
653
|
+
/** refine 参数 → 带约束模板的下标表(shape 检查用) */
|
|
654
|
+
declare function refineToIndexedFull(source: string, fnName: string, paramNames: string[], opts?: RefineResolveOpts): Array<[number, RefineEntry]>;
|
|
655
|
+
/**
|
|
656
|
+
* 解析 `@nudo:refine return positive` → 返回精化。
|
|
657
|
+
* 返回 undefined = 无声明(不猜后置)。
|
|
658
|
+
*/
|
|
659
|
+
declare function extractRefineReturnFromSource(source: string, fnName: string, opts?: RefineResolveOpts): {
|
|
660
|
+
name: string;
|
|
661
|
+
constraint: NudoConstraint;
|
|
662
|
+
} | undefined;
|
|
663
|
+
|
|
664
|
+
type LoadDepsFingerprint = {
|
|
665
|
+
fp: string;
|
|
666
|
+
paths: string[];
|
|
667
|
+
/** BFS 撞到节点上限:剩余 dep 未进指纹,键不可信 */
|
|
668
|
+
truncated: boolean;
|
|
669
|
+
};
|
|
670
|
+
declare function normPath(p: string): string;
|
|
671
|
+
/** core 不引 path:相对 spec 纯字符串拼接(与 LSP resolve 对齐时双方 norm) */
|
|
672
|
+
declare function resolveDepPath(fromFile: string, spec: string): string;
|
|
673
|
+
/**
|
|
674
|
+
* All string module specs that analysis may resolve through loadModule.
|
|
675
|
+
* Regex over-approximates (may hit comments) — extra dep fingerprint is safe
|
|
676
|
+
* (more misses, never a stale hit).
|
|
677
|
+
*/
|
|
678
|
+
declare function extractAllLoadSpecs(source: string): string[];
|
|
679
|
+
/**
|
|
680
|
+
* Fingerprint every loadModule-reachable dep (not only `*.nudo.js`), including
|
|
681
|
+
* one hop of transitive specs from each dep source.
|
|
682
|
+
*/
|
|
683
|
+
declare function loadModuleDepsFingerprint(source: string, loadModule: (spec: string, fromFile: string) => string | undefined, fromFile: string): LoadDepsFingerprint;
|
|
684
|
+
|
|
685
|
+
declare function resetGeneralizeMemo(): void;
|
|
686
|
+
declare function getGeneralizeMemoSize(): number;
|
|
687
|
+
/**
|
|
688
|
+
* LSP/宿主:`*.nudo.js` 变更后按路径定向逐出依赖它的 L0 条目。
|
|
689
|
+
* 返回删除的条目数。路径需与 generalize 时 resolveDepPath 形态一致(建议先 norm)。
|
|
690
|
+
*/
|
|
691
|
+
declare function evictGeneralizeMemoForPaths(paths: string[]): number;
|
|
692
|
+
type TypeParam = {
|
|
693
|
+
id: string;
|
|
694
|
+
value: Abs;
|
|
695
|
+
};
|
|
696
|
+
type PolyFn = {
|
|
697
|
+
name: string;
|
|
698
|
+
params: string[];
|
|
699
|
+
typeParams: TypeParam[];
|
|
700
|
+
instantiate: (args: Abs[], phi?: Phi) => Abs;
|
|
701
|
+
symbolic: Abs;
|
|
702
|
+
display: string;
|
|
703
|
+
/** 入口契约(@nudo:refine),供签名/inlay 展示 */
|
|
704
|
+
entryReqs?: Array<{
|
|
705
|
+
param: string;
|
|
706
|
+
pred: Pred;
|
|
707
|
+
}>;
|
|
708
|
+
/**
|
|
709
|
+
* 函数形参的符号外延(与 typeParams 同 α 空间)。
|
|
710
|
+
* symbolic 一次跑正常结束时从 env 快照拷出;instantiate 重跑不写。
|
|
711
|
+
*/
|
|
712
|
+
fnRels?: Map<string, {
|
|
713
|
+
abs: Abs;
|
|
714
|
+
source: RelSource;
|
|
715
|
+
}>;
|
|
716
|
+
/**
|
|
717
|
+
* 值形参(非函数)的提升快照,如 `items → arr(A1)`。
|
|
718
|
+
*/
|
|
719
|
+
entryShapes?: Map<string, {
|
|
720
|
+
abs: Abs;
|
|
721
|
+
source: RelSource;
|
|
722
|
+
}>;
|
|
723
|
+
/** body 内对该形参的应用点(check/hover/dts 用) */
|
|
724
|
+
hofSites?: HofSite[];
|
|
725
|
+
};
|
|
726
|
+
declare function extractFn(source: string, fnName: string, fileAst?: ReturnType<typeof parseSource>): {
|
|
727
|
+
params: string[];
|
|
728
|
+
body: Node;
|
|
729
|
+
env: AstEnv;
|
|
730
|
+
} | undefined;
|
|
731
|
+
declare function generalizeFromAst(fnName: string, source: string, opts?: {
|
|
732
|
+
budget?: LeakBudget;
|
|
733
|
+
label?: string;
|
|
734
|
+
/** 传入则把 @nudo:refine 挂到入口 param Abs */
|
|
735
|
+
refine?: RefineResolveOpts;
|
|
736
|
+
/** 预解析 AST,避免 check 批量场景重复 parse */
|
|
737
|
+
file?: ReturnType<typeof parseSource>;
|
|
738
|
+
/** 预计算 load-deps 指纹(checkSource 整文件一次,避免 per-fn 重读) */
|
|
739
|
+
depsFp?: LoadDepsFingerprint;
|
|
740
|
+
}): PolyFn | undefined;
|
|
741
|
+
declare function generalizeAll(source: string, opts?: {
|
|
742
|
+
budget?: LeakBudget;
|
|
743
|
+
}): PolyFn[];
|
|
744
|
+
/** 列出源码中的顶层函数名 */
|
|
745
|
+
declare function listFunctionNames(source: string): string[];
|
|
746
|
+
/**
|
|
747
|
+
* 按 assume 集合构造实参:被 assume 的参数给带约束的符号,其余 unknown。
|
|
748
|
+
*/
|
|
749
|
+
declare function buildArgsFromAssume(source: string, fnName: string, assumeIds: Set<string>): Abs[];
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* 约束诊断:检查调用点实参是否满足函数的前置约束 / 参数 shape。
|
|
753
|
+
* 输出可行动的建议,而不是 TS 式「类型不匹配」。
|
|
754
|
+
*/
|
|
755
|
+
|
|
756
|
+
type Diagnostic = {
|
|
757
|
+
severity: "error" | "warning" | "info";
|
|
758
|
+
code: string;
|
|
759
|
+
message: string;
|
|
760
|
+
suggestion?: string;
|
|
761
|
+
fn?: string;
|
|
762
|
+
argIndex?: number;
|
|
763
|
+
};
|
|
764
|
+
/**
|
|
765
|
+
* 检查实参是否满足「期望约束」。
|
|
766
|
+
* expect: 相对参数 term 的 pred,例如 term > 0
|
|
767
|
+
* arg: 实际实参 Abs
|
|
768
|
+
*/
|
|
769
|
+
declare function checkArg(arg: Abs, expect: Pred | undefined, phi?: Phi): Diagnostic | undefined;
|
|
770
|
+
/**
|
|
771
|
+
* 对一次函数调用做诊断:实参 shape + 约束。
|
|
772
|
+
*/
|
|
773
|
+
declare function checkCall(source: string, fnName: string, args: Abs[], phi?: Phi): Diagnostic[];
|
|
774
|
+
declare function formatDiagnostics(diags: Diagnostic[]): string;
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Template string 拼接(代数侧)。
|
|
778
|
+
* 表示:prim(string) + refinement.meta.templateParts = Abs[]
|
|
779
|
+
* 与 core 的 createTemplate 对齐,使 `"x" + string + "!"` 得到 template refined。
|
|
780
|
+
*/
|
|
781
|
+
|
|
782
|
+
type TemplateMeta = {
|
|
783
|
+
templateParts: Abs[];
|
|
784
|
+
};
|
|
785
|
+
/** 从 Abs 提取 template parts(已是 template 则展开,否则 [self]) */
|
|
786
|
+
declare function templatePartsOf(a: Abs): Abs[];
|
|
787
|
+
/**
|
|
788
|
+
* 构造 template Abs。
|
|
789
|
+
* - 全字面量 → exact lit
|
|
790
|
+
* - 单 string prim → prim
|
|
791
|
+
* - 否则 prim(string) + pred(name=template, meta.templateParts)
|
|
792
|
+
*/
|
|
793
|
+
declare function createTemplateAbs(parts: Abs[]): Abs;
|
|
794
|
+
declare function isTemplateLike(a: Abs): boolean;
|
|
795
|
+
/** 字符串拼接:字面量折叠 + template parts 合并 */
|
|
796
|
+
declare function concatString(a: Abs, b: Abs): Abs;
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* 语言覆盖:class / new / instanceof / this / async await。
|
|
800
|
+
* brand 表示名义类;eff("promise") 表示异步效应。
|
|
801
|
+
*
|
|
802
|
+
* 方法体:ClassDef.methods 存 AST body,调用时在 this=receiver 下求值。
|
|
803
|
+
*/
|
|
804
|
+
|
|
805
|
+
type MethodDef = {
|
|
806
|
+
name: string;
|
|
807
|
+
params: string[];
|
|
808
|
+
body: Node;
|
|
809
|
+
kind?: string;
|
|
810
|
+
async?: boolean;
|
|
811
|
+
};
|
|
812
|
+
type ClassDef = {
|
|
813
|
+
name: string;
|
|
814
|
+
instanceShape: Abs;
|
|
815
|
+
ctorParams: string[];
|
|
816
|
+
methods: Map<string, MethodDef>;
|
|
817
|
+
superClass?: string;
|
|
818
|
+
};
|
|
819
|
+
declare function defineClass(env: AstEnv, def: ClassDef): void;
|
|
820
|
+
declare function getClass(env: AstEnv, name: string): ClassDef | undefined;
|
|
821
|
+
/** 沿继承链找类 */
|
|
822
|
+
declare function getClassChain(env: AstEnv, name: string): ClassDef[];
|
|
823
|
+
/** new C(...) → brand 实例;并跑 constructor 以写入字段 */
|
|
824
|
+
declare function instantiateClass(env: AstEnv, className: string, args: Abs[], evalBody?: (fn: {
|
|
825
|
+
params: string[];
|
|
826
|
+
body: Node;
|
|
827
|
+
}, args: Abs[], thisVal: Abs, env: AstEnv) => Abs): Abs;
|
|
828
|
+
/** 读取当前 this 所属类的父类名 */
|
|
829
|
+
declare function superNameOf(env: AstEnv, className: string): string | undefined;
|
|
830
|
+
/**
|
|
831
|
+
* instanceof:沿继承链匹配 brand 名。
|
|
832
|
+
*/
|
|
833
|
+
declare function instanceOf(left: Abs, rightClassName: string, env?: AstEnv): Abs;
|
|
834
|
+
declare function projectBrand(self: Abs, key: string): Abs;
|
|
835
|
+
/** 在 brand 上查找方法定义(含继承) */
|
|
836
|
+
declare function lookupMethod(env: AstEnv, receiver: Abs, methodName: string): MethodDef | undefined;
|
|
837
|
+
/** 沿继承链查找方法,返回定义与所在类名 */
|
|
838
|
+
declare function lookupMethodWithOwner(env: AstEnv, receiver: Abs, methodName: string): {
|
|
839
|
+
def: MethodDef;
|
|
840
|
+
owner: string;
|
|
841
|
+
} | undefined;
|
|
842
|
+
/** super.method():从父类开始找(跳过当前类) */
|
|
843
|
+
declare function lookupSuperMethod(env: AstEnv, receiver: Abs, fromClass: string, methodName: string): {
|
|
844
|
+
def: MethodDef;
|
|
845
|
+
owner: string;
|
|
846
|
+
} | undefined;
|
|
847
|
+
declare function wrapPromise(inner: Abs): Abs;
|
|
848
|
+
declare function awaitAbs(v: Abs): Abs;
|
|
849
|
+
declare function coerceAsyncReturn(value: Abs): Abs;
|
|
850
|
+
/** 从 ClassMethod 列表构造 methods map + instance shape */
|
|
851
|
+
declare function classFromMethods(name: string, methods: MethodDef[], superClass?: string, superShape?: Abs): ClassDef;
|
|
852
|
+
|
|
853
|
+
declare function hashSource(s: string): string;
|
|
854
|
+
declare function resetHashSourceCache(): void;
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Analysis-stable source key: strip trailing noise that cannot affect types.
|
|
858
|
+
* Keeps every line that may carry @nudo directives.
|
|
859
|
+
*
|
|
860
|
+
* Fast path: already-stable sources return the same string identity (O(1)
|
|
861
|
+
* compare in B-path / analysis caches when the caller reuses the buffer).
|
|
862
|
+
*/
|
|
863
|
+
declare function stableAnalyzeKeySource(source: string): string;
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* per-function fingerprint: after-edit only dirty fn + callers miss L0.
|
|
867
|
+
*
|
|
868
|
+
* - own: function declaration slice (incl. leading comments / refine)
|
|
869
|
+
* - deps: transitively referenced sibling own hashes + non-fn top-level context
|
|
870
|
+
* - context change (import/class/const...) -> all miss (conservative)
|
|
871
|
+
*
|
|
872
|
+
* Multi-declarator `const a = fn, b = fn` yields one fingerprint per function;
|
|
873
|
+
* each own-slice is its own declarator (first also carries statement leading comments).
|
|
874
|
+
*/
|
|
875
|
+
|
|
876
|
+
type FnFp = {
|
|
877
|
+
own: string;
|
|
878
|
+
deps: string;
|
|
879
|
+
nRefs: number;
|
|
880
|
+
};
|
|
881
|
+
declare function resetFnFpCache(): void;
|
|
882
|
+
type FnDeclInfo = {
|
|
883
|
+
name: string;
|
|
884
|
+
body: Node;
|
|
885
|
+
/** Function/arrow node (own-slice end; also scanned for sibling refs incl. defaults). */
|
|
886
|
+
fnNode: Node;
|
|
887
|
+
/** Declarator start when from a VariableDeclaration; else undefined. */
|
|
888
|
+
declaratorStart?: number;
|
|
889
|
+
/** First leading-comment start on this declarator (multi-decl refine/@nudo). */
|
|
890
|
+
declaratorLeadStart?: number;
|
|
891
|
+
};
|
|
892
|
+
/** Every top-level function binding in a declaration node (not just the first). */
|
|
893
|
+
declare function getFnNameAndBodies(decl: Node): FnDeclInfo[];
|
|
894
|
+
/** source -> (fnName -> own/deps); LRU */
|
|
895
|
+
declare function fnFingerprints(source: string, file: File): Map<string, FnFp>;
|
|
896
|
+
/** L0 source part: per-fn fingerprint when AST available; else full-file hash */
|
|
897
|
+
declare function generalizeSourceKeyPart(source: string, fnName: string, file?: File): string;
|
|
898
|
+
/**
|
|
899
|
+
* 无 refine、无模块语法、无兄弟调用、无任何调用表达式 → scanLiteralCalls 可整段跳过。
|
|
900
|
+
* 必须保守:`const x = f(-1)` / `if (f(-1))` / `require("x")` 都含 CallExpression,
|
|
901
|
+
* 只认顶层 ExpressionStatement 会漏报约束违规。
|
|
902
|
+
*/
|
|
903
|
+
declare function canSkipLiteralCallScan(source: string, file: File): boolean;
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* check 报告面:数据模型 + 渲染/序列化。
|
|
907
|
+
*
|
|
908
|
+
* 分析在 check.ts(Abs 优先的 Nudo 原生诊断),这里只投影:
|
|
909
|
+
* - formatCheckReport → 人类可读文本
|
|
910
|
+
* - serializeCheckJson → `nudo check --json` 稳定契约(CI / Agent,v1)
|
|
911
|
+
*/
|
|
912
|
+
|
|
913
|
+
/** 无损函数签名(类型即计算) */
|
|
914
|
+
type NudoSig = {
|
|
915
|
+
name: string;
|
|
916
|
+
params: string[];
|
|
917
|
+
/** 符号 Abs 本体 */
|
|
918
|
+
abs: Abs;
|
|
919
|
+
/** formatAbs 单行 */
|
|
920
|
+
display: string;
|
|
921
|
+
/** formatAbsMultiline */
|
|
922
|
+
detail: string;
|
|
923
|
+
conf: Confidence;
|
|
924
|
+
};
|
|
925
|
+
type CheckIssue = Diagnostic & {
|
|
926
|
+
fn?: string;
|
|
927
|
+
line?: number;
|
|
928
|
+
column?: number;
|
|
929
|
+
/** 实参 / 实际值的 Abs 展示 */
|
|
930
|
+
actual?: string;
|
|
931
|
+
/** 期望约束(Pred 或 Abs 展示) */
|
|
932
|
+
expected?: string;
|
|
933
|
+
};
|
|
934
|
+
type CheckReport = {
|
|
935
|
+
file: string;
|
|
936
|
+
issues: CheckIssue[];
|
|
937
|
+
/** 有 error 则 CI 应失败 */
|
|
938
|
+
ok: boolean;
|
|
939
|
+
/** Abs 优先的签名表(替代 TS 式 display-only) */
|
|
940
|
+
signatures: NudoSig[];
|
|
941
|
+
summary: {
|
|
942
|
+
errors: number;
|
|
943
|
+
warnings: number;
|
|
944
|
+
infos: number;
|
|
945
|
+
functions: number;
|
|
946
|
+
};
|
|
947
|
+
};
|
|
948
|
+
/**
|
|
949
|
+
* `nudo check --json` 稳定契约(供 CI / Agent)。
|
|
950
|
+
* 字段只增不改语义;Abs 以 formatAbs 字符串给出,不序列化内部 shape 图。
|
|
951
|
+
*/
|
|
952
|
+
type CheckJson = {
|
|
953
|
+
version: 1;
|
|
954
|
+
file: string;
|
|
955
|
+
ok: boolean;
|
|
956
|
+
summary: CheckReport["summary"];
|
|
957
|
+
signatures: Array<{
|
|
958
|
+
name: string;
|
|
959
|
+
params: string[];
|
|
960
|
+
display: string;
|
|
961
|
+
detail: string;
|
|
962
|
+
conf: string;
|
|
963
|
+
abs: string;
|
|
964
|
+
}>;
|
|
965
|
+
issues: Array<{
|
|
966
|
+
severity: string;
|
|
967
|
+
code: string;
|
|
968
|
+
message: string;
|
|
969
|
+
fn?: string;
|
|
970
|
+
line?: number;
|
|
971
|
+
column?: number;
|
|
972
|
+
actual?: string;
|
|
973
|
+
expected?: string;
|
|
974
|
+
suggestion?: string;
|
|
975
|
+
}>;
|
|
976
|
+
};
|
|
977
|
+
declare function serializeCheckJson(r: CheckReport): CheckJson;
|
|
978
|
+
/**
|
|
979
|
+
* Nudo 原生报告:Abs 签名表 + actual ⊭ expected。
|
|
980
|
+
* 不是 tsc 输出的换皮。
|
|
981
|
+
*/
|
|
982
|
+
declare function formatCheckReport(r: CheckReport, opts?: {
|
|
983
|
+
verbose?: boolean;
|
|
984
|
+
}): string;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* nudo check 门禁:对源码跑代数分析,产出 error/warning。
|
|
988
|
+
*
|
|
989
|
+
* 报告是 **Nudo 原生格式**(Abs 优先),不是 TS 诊断的换皮:
|
|
990
|
+
* - 签名表给出无损 Abs(shape/term/pred/conf)
|
|
991
|
+
* - 违例写清 actual ⊭ expected(实参 Abs vs 前置 Pred)
|
|
992
|
+
* - dts/TS 兼容不是本报告的职责
|
|
993
|
+
*/
|
|
994
|
+
|
|
995
|
+
declare function resetCheckSourceMemo(): void;
|
|
996
|
+
declare function getCheckSourceMemoSize(): number;
|
|
997
|
+
/** `*.nudo.js` 变更后定向逐出依赖它的整文件 check 缓存 */
|
|
998
|
+
declare function evictCheckSourceMemoForPaths(paths: string[]): number;
|
|
999
|
+
/**
|
|
1000
|
+
* check 选项:core 不碰 fs;host 用 loadModule 喂 require 目标源码。
|
|
1001
|
+
*/
|
|
1002
|
+
type CheckOptions = {
|
|
1003
|
+
/** 相对/绝对 require 说明符 → 模块源码;undefined = 解析失败 */
|
|
1004
|
+
loadModule?: (spec: string, fromFile: string) => string | undefined;
|
|
1005
|
+
/** 当前文件路径(供 loadModule 解析相对 spec) */
|
|
1006
|
+
fromFile?: string;
|
|
1007
|
+
};
|
|
1008
|
+
/**
|
|
1009
|
+
* 检查一个文件:
|
|
1010
|
+
* - 每个顶层函数 generalize;无法得到任何签名 → warning
|
|
1011
|
+
* - 若 source 中有字面量调用 `f(负数)` 且 f 有 `>0` 约束 → error
|
|
1012
|
+
* - entry 结果 partial/opaque → info
|
|
1013
|
+
*
|
|
1014
|
+
* 默认 Φ(pTrue)走整文件 memo:同 source + deps + loadModule 身份 → O(1)。
|
|
1015
|
+
*/
|
|
1016
|
+
declare function checkSource(filePath: string, source: string, phi?: Phi, opts?: CheckOptions): CheckReport;
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Abs inlay hint:把无损约束内联到源码位置。
|
|
1020
|
+
* 不是 TS 风格 type annotation 复读,而是 term/pred/conf 的计算结果。
|
|
1021
|
+
*/
|
|
1022
|
+
type AbsInlay = {
|
|
1023
|
+
/** 1-based 行号 */
|
|
1024
|
+
line: number;
|
|
1025
|
+
/** 0-based 列(label 插入点) */
|
|
1026
|
+
character: number;
|
|
1027
|
+
label: string;
|
|
1028
|
+
kind: "type" | "parameter";
|
|
1029
|
+
};
|
|
1030
|
+
/**
|
|
1031
|
+
* 收集源码中函数签名的 Abs inlay:
|
|
1032
|
+
* - 参数后:前置约束(声明 refine 优先;否则从 if 推)
|
|
1033
|
+
* - `)` 后:返回 shape + term(类型即计算)
|
|
1034
|
+
*/
|
|
1035
|
+
declare function collectAbsInlays(source: string, refineOpts?: {
|
|
1036
|
+
loadModule?: (spec: string, fromFile: string) => string | undefined;
|
|
1037
|
+
fromFile?: string;
|
|
1038
|
+
}): AbsInlay[];
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* 指称:Abs → 运行时谓词(设计 §2.7)。
|
|
1042
|
+
* - 无 pred:按 shape 检查(typeof / 结构)
|
|
1043
|
+
* - 有 pred:在 `term ↦ v` 下检查可判定的数值比较
|
|
1044
|
+
* - sum:任一成员
|
|
1045
|
+
*/
|
|
1046
|
+
|
|
1047
|
+
/** Abs 上的运行时守卫表达式(JS boolean 布尔串) */
|
|
1048
|
+
declare function denoteGuard(a: Abs, v: string): string;
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Abs ⇄ TypeValue 桥。
|
|
1052
|
+
*
|
|
1053
|
+
* 纪律:
|
|
1054
|
+
* - absToTypeValue 有损:丢 term/pred 时 conf 降为 widened,禁止假装 exact
|
|
1055
|
+
* - typeValueToAbs 尽量恢复 term=lit
|
|
1056
|
+
* - 下游(dts/lsp/service)吃 TypeValue;代数运算吃 Abs
|
|
1057
|
+
*/
|
|
1058
|
+
|
|
1059
|
+
declare function setTvConfidence(tv: TypeValue, conf: Confidence): void;
|
|
1060
|
+
declare function getTvConfidence(tv: TypeValue): Confidence | undefined;
|
|
1061
|
+
/**
|
|
1062
|
+
* Abs → TypeValue(给下游)。
|
|
1063
|
+
* 有损:非 lit term 丢弃;pred 尽量 encode 成 refined,否则丢。
|
|
1064
|
+
*/
|
|
1065
|
+
declare function absToTypeValue(a: Abs): TypeValue;
|
|
1066
|
+
/**
|
|
1067
|
+
* TypeValue → Abs(给代数运算)。
|
|
1068
|
+
* 置信度:优先读 abs→tv 时挂上的 conf 旁路,避免 #widened 回升 #exact。
|
|
1069
|
+
*/
|
|
1070
|
+
declare function typeValueToAbs(tv: TypeValue): Abs;
|
|
1071
|
+
/**
|
|
1072
|
+
* 有损检查:Abs 转 TypeValue 后是否丢了 term/pred。
|
|
1073
|
+
* 用于金标与调试。
|
|
1074
|
+
*/
|
|
1075
|
+
declare function bridgeIsLossy(a: Abs): {
|
|
1076
|
+
lossy: boolean;
|
|
1077
|
+
reasons: string[];
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
export { Abs, type AbsFnImpl, type AbsInlay, AstEnv, type CheckIssue, type CheckJson, type CheckOptions, type CheckReport, type ClassDef, Confidence, type ConstraintBuilder, type Diagnostic, type Environment, type FnAbs, type FnFp, type FormatOptions, type FunctionSignature, HofSite, LeakBudget, type LeqResult, type LiteralValue, type LoadDepsFingerprint, type MethodDef, type MockHelper, type NamedImport, type NudoConstraint, type NudoField, type NudoSig, type ObjShape, Ops, Phi, type PolyFn, Pred, PrimName, type RangeMeta, type RefineEntry, type RefineResolveOpts, type Refinement, RelSource, SELF, Shape, type SigImpl, type Slot, T, type TemplateMeta, Term, type TypeParam, type TypeValue, absFunction, absToTypeValue, add, applyBinaryOp, array, attachFnImpl, awaitAbs, boolean, bridgeIsLossy, buildArgsFromAssume, callAbsMethod, canSkipLiteralCallScan, checkArg, checkCall, checkSource, classFromMethods, cmp, coerceAsyncReturn, collapseLiteralUnion, collapseToOptional, collectAbsInlays, concatString, concatTemplates, constraintToEntryAbs, createEnvironment, createRange, createTemplate, createTemplateAbs, currentPhi, deepCloneTypeValue, defineClass, definitelyNotNullishShape, denoteGuard, describePhi, dispatchBinaryOp, dispatchMethod, dispatchProperty, div, evalArrayStatic, evalBuiltinInstanceMethod, evalBuiltinNew, evalDateCtor, evalDateMethod, evalDateStatic, evalGlobalFn, evalJsonMethod, evalMathMethod, evalNamespaceCall, evalNumberStatic, evalObjectMethod, evalPromiseCtor, evalPromiseStatic, evalRegExpCtor, evalRegExpMethod, evictCheckSourceMemoForPaths, evictGeneralizeMemoForPaths, execNudoModule, extractAllLoadSpecs, extractFn, extractNudoImports, extractRefineReturnFromSource, extractRefinesFromSource, falseConstraint, fnFingerprints, fnOf, formatAbs, formatAbsMultiline, formatCheckReport, formatDiagnostics, formatShape, formatShapeSlot, generalizeAll, generalizeFromAst, generalizeSourceKeyPart, getAbsProperty, getCheckSourceMemoSize, getClass, getClassChain, getFnImpl, getFnNameAndBodies, getFnSig, getGeneralizeMemoSize, getKnownPrefix, getKnownSuffix, getParseSourceCacheSize, getPrimitiveTypeOf, getRangeMeta, getRefinedBase, getTemplateParts, getTerm, getTvConfidence, hashSource, instanceOf, instantiateClass, instantiateConstraint, isFnSig, isNudoConstraint, isNullishLitAbs, isObj, isRange, isSubtypeOf, isTemplate, isTemplateLike, joinAbs, joinFunctions, joinObjects, joinValues, lenTerm, leqAbs, listFunctionNames, loadModuleDepsFingerprint, lookupMethod, lookupMethodWithOwner, lookupSuperMethod, makeSum, mergeObjectProperties, mock, mockHelperToTypeValue, mod, mul, narrowType, negAbs, normPath, notAbs, number, numericBounds, objOf, parseSource, popPhi, projectBrand, pushPhi, refineToIndexedFull, relationFingerprint, relationFn, resetCheckSourceMemo, resetFnFpCache, resetGeneralizeMemo, resetHashSourceCache, resetNudoModuleExecCache, resetParseSourceCache, resetPhi, resolveDepPath, serializeCheckJson, setTvConfidence, shape, shapeOnlyFn, simplifyUnion, spread, spy, stableAnalyzeKeySource, strictEqAbs, string, stripTypes, stub, sub, subtractType, superNameOf, templatePartsOf, trueConstraint, typeValueEquals, typeValueToAbs, typeValueToString, typeofAbs, widenLiteral, withPhiConstraint, wrapPromise };
|