@nudojs/core 1.9.0 → 1.9.2

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/dist/exec.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Abs, M as MayThrowEffect, b as Phi } from './run-DbDRo5z6.js';
2
- export { W as $assignRecord, X as $call, Y as $callNamed, Z as $recordBinding, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, f as EvalFallbackStats, aa as MAX_EVAL_CALL_DEPTH, ab as MAX_EVAL_TOTAL_CALLS, ac as RUNTIME_IMPORT_RE, V as RunTranspiledOptions, ae as TranspiledCallResult, as as bindingsOf, av as callTranspiledExport, aw as callTranspiledExportApply, ax as callTranspiledExportFull, k as clearPureCallMemo, l as clearPureMemo, m as enterEvalCallBudgetSession, aC as evalExprAbs, o as exitEvalCallBudgetSession, u as getEvalCallBudgetState, aF as getEvalCallCollector, v as getEvalFallbackStats, aN as isAbsVal, b3 as noteEvalCallRecord, b4 as noteEvalFallback, bl as resetEvalCallBudget, G as resetEvalFallbackStats, bF as routeApplyThrows, bm as runTranspiled, bn as runTranspiledOptionsMemoKey, bo as setEvalAssignCollector, bp as setEvalBindingSink, bq as setEvalCallCollector, br as setEvalFallbackCollector, bC as tryRunTranspiled, N as withEvalBudgetOverride } from './run-DbDRo5z6.js';
1
+ import { A as Abs, M as MayThrowEffect, b as Phi } from './run-2B7ohsfP.js';
2
+ export { W as $assignRecord, X as $call, Y as $callNamed, Z as $recordBinding, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, f as EvalFallbackStats, aa as MAX_EVAL_CALL_DEPTH, ab as MAX_EVAL_TOTAL_CALLS, ac as RUNTIME_IMPORT_RE, V as RunTranspiledOptions, ae as TranspiledCallResult, as as bindingsOf, av as callTranspiledExport, aw as callTranspiledExportApply, ax as callTranspiledExportFull, k as clearPureCallMemo, l as clearPureMemo, m as enterEvalCallBudgetSession, aC as evalExprAbs, o as exitEvalCallBudgetSession, u as getEvalCallBudgetState, aF as getEvalCallCollector, v as getEvalFallbackStats, aN as isAbsVal, b3 as noteEvalCallRecord, b4 as noteEvalFallback, bl as resetEvalCallBudget, G as resetEvalFallbackStats, bF as routeApplyThrows, bm as runTranspiled, bn as runTranspiledOptionsMemoKey, bo as setEvalAssignCollector, bp as setEvalBindingSink, bq as setEvalCallCollector, br as setEvalFallbackCollector, bC as tryRunTranspiled, N as withEvalBudgetOverride } from './run-2B7ohsfP.js';
3
3
  import { Node, Expression, File } from '@babel/types';
4
4
 
5
5
  /**
@@ -119,20 +119,16 @@ declare class NudoReturn extends Error {
119
119
  declare function isNudoReturn(e: unknown): e is NudoReturn;
120
120
  /** transpile `return x` inside for/while → `$loopReturn(x)` */
121
121
  declare function $loopReturn(v: Abs): never;
122
- /**
123
- * break/continue 信号:transpile 在循环体内生成 $loopBreak/$loopContinue,
124
- * $for/$whileSeq/$forOf 在 body 调用点捕获。带标签信号只被同标签循环吸收,
125
- * 不匹配继续冒泡到外层循环(`break outer` / `continue outer` 语义)。
126
- */
127
122
  declare class NudoLoopSignal extends Error {
128
123
  readonly kind: "break" | "continue";
129
124
  readonly label: string | undefined;
125
+ readonly abstract: boolean;
130
126
  constructor(kind: "break" | "continue", label?: string);
131
127
  }
132
128
  declare function $loopBreak(label?: string): never;
133
129
  declare function $loopContinue(label?: string): never;
134
- declare function isNudoBreak(e: unknown, label?: string): boolean;
135
- declare function isNudoContinue(e: unknown, label?: string): boolean;
130
+ declare function isNudoBreak(e: unknown, label?: string): e is NudoLoopSignal;
131
+ declare function isNudoContinue(e: unknown, label?: string): e is NudoLoopSignal;
136
132
  /** 非循环 labeled block:判断 break 信号是否指向本标签(transpile 生成代码用) */
137
133
  declare function $isBreakTo(e: unknown, label: string): boolean;
138
134
  /** catch 转译辅助:控制流信号透传(生成代码只注入 `$` 前缀符号) */
@@ -313,6 +309,11 @@ declare function $arguments(items: ArrayLike<unknown>): Abs;
313
309
  */
314
310
  declare function $arrWithHoles(items: Abs[], holes: number[]): Abs;
315
311
  declare function isArrMutator(name: string): boolean;
312
+ /**
313
+ * rest 形参绑定(Bug 44):收集 namedCount 之后的实参包 $arr(长度保持
314
+ * 原生——真调用面);唯一元素是符号注入哨兵时直通开放数组(签名面)。
315
+ */
316
+ declare function $restBind(list: ArrayLike<unknown>, namedCount: number): Abs;
316
317
  declare function fillTuple(shape: {
317
318
  k: "tuple";
318
319
  elements: Abs[];
@@ -467,13 +468,23 @@ declare function $removeNull(a: Abs): Abs;
467
468
  */
468
469
  declare function $removeUndefined(a: Abs): Abs;
469
470
  /**
470
- * 成员真值守卫臂剪影(issue #118):`if (o.p)` 真值臂 / `if (!o.p)` 假值臂 /
471
- * `o?.p` 真值守卫里,槽 p 的值必为真值 ⇒ 非 nullish 且槽必在场——重建 obj
472
- * slots:槽值过与 $removeNullish 同款成员剥离,并摘除 optional 标记
473
- * (真值 ⇒ 在场;$get 的 join(value, undef) 随之消失)。槽值剥空(纯
471
+ * 成员真值守卫臂剪影(issue #118 / #129):`if (o.p)` 真值臂 / `if (!o.p)`
472
+ * 假值臂 / `o?.p` 真值守卫里,槽 p 的值必为真值 ⇒ 非 nullish 且槽必在场——
473
+ * 重建 obj slots:槽值过与 $removeNullish 同款成员剥离,并摘除 optional
474
+ * 标记(真值 ⇒ 在场;$get 的 join(value, undef) 随之消失)。槽值剥空(纯
474
475
  * nullish)→ 保守原样(臂不可达近似,与 $removeNullish 空集口径一致);
475
476
  * 键缺席 / 非 obj / 裸宿主值 → 透传(同 $removeNullish 契约)。真值 ⇒ 非
476
477
  * nullish 是 sound 下界:0/''/false 等 falsy-but-not-nullish 成员保留。
478
+ *
479
+ * sum 容器(issue #129):判别窄化后参数常为多臂 union——守卫事实按成员
480
+ * 分发:key 槽确定 nullish 的成员(闭 shape 槽缺席且缺席读确定 undefined
481
+ * ——open/index/proto 方法名/getter 均不在场;或槽值整体 nullish)在真值
482
+ * 守卫下必走早退 → 剪除;其余成员按 obj 分支同款重建(重建迁移
483
+ * accessor/propFlags/nullProto 侧表)。open/index 缺席(读 unknown 不可
484
+ * 判)/ proto 方法名与 constructor 缺席(原型链读出函数)/ getter-only
485
+ * 缺席(读 getter 结果)/ any / unknown 槽值 / 非对象成员不可判保留(宁
486
+ * 缺毋假,与 $get 缺席读同口径)。全剪空 → 原样;单成员剪余塌缩(与
487
+ * $narrowMemberEq 同口径)。
477
488
  */
478
489
  declare function $removeMemberNullish(a: Abs, key: string): Abs;
479
490
  /**
@@ -762,4 +773,4 @@ declare class NudoUnsupportedError extends Error {
762
773
  detail?: string);
763
774
  }
764
775
 
765
- export { $absVal, $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $getSuper, $getSuperObj, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $invokeSuperKey, $invokeSuperObj, $isBreakTo, $isForkExit, $iterCheck, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $narrowMemberEq, $narrowTypeOf, $ne, $neLoose, $neg, $new, $newTarget, $not, $nullishTest, $obj, $objAccessor, $objAccessorKey, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $removeMemberNullish, $removeNull, $removeNullish, $removeUndefined, $rethrowIfNudoReturn, $set, $setKey, $setProto, $shl, $shr, $spread, $staticInit, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tpl, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, $yieldStar, DEFAULT_MAX_LOOP_ITERS, type EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, type TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi };
776
+ export { $absVal, $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $getSuper, $getSuperObj, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $invokeSuperKey, $invokeSuperObj, $isBreakTo, $isForkExit, $iterCheck, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $narrowMemberEq, $narrowTypeOf, $ne, $neLoose, $neg, $new, $newTarget, $not, $nullishTest, $obj, $objAccessor, $objAccessorKey, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $removeMemberNullish, $removeNull, $removeNullish, $removeUndefined, $restBind, $rethrowIfNudoReturn, $set, $setKey, $setProto, $shl, $shr, $spread, $staticInit, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tpl, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, $yieldStar, DEFAULT_MAX_LOOP_ITERS, type EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, type TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi };
package/dist/exec.js CHANGED
@@ -91,6 +91,7 @@ import {
91
91
  $removeNull,
92
92
  $removeNullish,
93
93
  $removeUndefined,
94
+ $restBind,
94
95
  $rethrowIfNudoReturn,
95
96
  $set,
96
97
  $setKey,
@@ -194,7 +195,7 @@ import {
194
195
  tryRunTranspiled,
195
196
  withEvalBudgetOverride,
196
197
  withExecPhi
197
- } from "./chunk-3SLNJPNY.js";
198
+ } from "./chunk-XR3TE4C2.js";
198
199
  export {
199
200
  $absVal,
200
201
  $add,
@@ -287,6 +288,7 @@ export {
287
288
  $removeNull,
288
289
  $removeNullish,
289
290
  $removeUndefined,
291
+ $restBind,
290
292
  $rethrowIfNudoReturn,
291
293
  $set,
292
294
  $setKey,
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { c as AstEnv, A as Abs, b as Phi, T as Term, O as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, Q as HofSite, U as AbsModuleExports, V as RunTranspiledOptions } from './run-DbDRo5z6.js';
2
- export { W as $assignRecord, X as $call, Y as $callNamed, Z as $recordBinding, _ as AbsApplyNoThrow, a0 as AbsApplyNoThrowFn, a1 as AbsApplyResult, a2 as AbsApplyReturn, a3 as AbsFnImpl, a4 as AbsSigImpl, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, a8 as ImplicationOracle, a9 as LitValueResult, L as LiteralValue, aa as MAX_EVAL_CALL_DEPTH, ab as MAX_EVAL_TOTAL_CALLS, P as PrimName, ac as RUNTIME_IMPORT_RE, ad as TYPEOF_NAMES, ae as TranspiledCallResult, af as TypeofName, ag as abs, ah as absFunction, ai as absOnly, aj as absToString, ak as and, al as anyAbs, am as anyVar, an as app, ao as assumeFinite, ap as attachFnImpl, aq as bigintLit, ar as bindImports, as as bindingsOf, at as bool, au as boolLit, av as callTranspiledExport, aw as callTranspiledExportApply, ax as callTranspiledExportFull, ay as collectAbsExports, az as confJoin, aA as emptyPhi, aB as eq, aC as evalExprAbs, aD as ge, aE as geNum, aF as getEvalCallCollector, aG as getFnImpl, aH as getImplicationOracle, aI as gt, aJ as gtNum, aK as hostFnCtorFacet, aL as implies, aM as isAbsApplyResult, aN as isAbsVal, aO as isBigPrim, aP as isExactLit, aQ as isNumPrim, aR as isStrPrim, aS as le, aT as leNum, aU as lit, aV as litValue, aW as lt, aX as ltNum, aY as makeAbsApplyResult, aZ as markPureFn, a_ as namespaceAbsOf, a$ as ne, b0 as negatePred, b1 as never, b2 as not, b3 as noteEvalCallRecord, b4 as noteEvalFallback, b5 as num, b6 as numLit, b7 as numVar, b8 as obj, b9 as or, ba as pFalse, bb as pTrue, bc as phiAnd, bd as predEquals, be as predToString, bf as predVars, bg as primToTypeof, bh as ptypeof, bi as pureFnNameOf, bj as relationFingerprint, bk as relationFn, bl as resetEvalCallBudget, bm as runTranspiled, bn as runTranspiledOptionsMemoKey, bo as setEvalAssignCollector, bp as setEvalBindingSink, bq as setEvalCallCollector, br as setEvalFallbackCollector, bs as setImplicationOracle, bt as shapeOfTerm, bu as shapeOnlyFn, bv as shapeToString, bw as simplifyTerm, bx as str, by as strLit, bz as substPred, bA as termEquals, bB as termToString, bC as tryRunTranspiled, bD as unknown, bE as v } from './run-DbDRo5z6.js';
1
+ import { c as AstEnv, A as Abs, b as Phi, T as Term, O as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, Q as HofSite, U as AbsModuleExports, V as RunTranspiledOptions } from './run-2B7ohsfP.js';
2
+ export { W as $assignRecord, X as $call, Y as $callNamed, Z as $recordBinding, _ as AbsApplyNoThrow, a0 as AbsApplyNoThrowFn, a1 as AbsApplyResult, a2 as AbsApplyReturn, a3 as AbsFnImpl, a4 as AbsSigImpl, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, a8 as ImplicationOracle, a9 as LitValueResult, L as LiteralValue, aa as MAX_EVAL_CALL_DEPTH, ab as MAX_EVAL_TOTAL_CALLS, P as PrimName, ac as RUNTIME_IMPORT_RE, ad as TYPEOF_NAMES, ae as TranspiledCallResult, af as TypeofName, ag as abs, ah as absFunction, ai as absOnly, aj as absToString, ak as and, al as anyAbs, am as anyVar, an as app, ao as assumeFinite, ap as attachFnImpl, aq as bigintLit, ar as bindImports, as as bindingsOf, at as bool, au as boolLit, av as callTranspiledExport, aw as callTranspiledExportApply, ax as callTranspiledExportFull, ay as collectAbsExports, az as confJoin, aA as emptyPhi, aB as eq, aC as evalExprAbs, aD as ge, aE as geNum, aF as getEvalCallCollector, aG as getFnImpl, aH as getImplicationOracle, aI as gt, aJ as gtNum, aK as hostFnCtorFacet, aL as implies, aM as isAbsApplyResult, aN as isAbsVal, aO as isBigPrim, aP as isExactLit, aQ as isNumPrim, aR as isStrPrim, aS as le, aT as leNum, aU as lit, aV as litValue, aW as lt, aX as ltNum, aY as makeAbsApplyResult, aZ as markPureFn, a_ as namespaceAbsOf, a$ as ne, b0 as negatePred, b1 as never, b2 as not, b3 as noteEvalCallRecord, b4 as noteEvalFallback, b5 as num, b6 as numLit, b7 as numVar, b8 as obj, b9 as or, ba as pFalse, bb as pTrue, bc as phiAnd, bd as predEquals, be as predToString, bf as predVars, bg as primToTypeof, bh as ptypeof, bi as pureFnNameOf, bj as relationFingerprint, bk as relationFn, bl as resetEvalCallBudget, bm as runTranspiled, bn as runTranspiledOptionsMemoKey, bo as setEvalAssignCollector, bp as setEvalBindingSink, bq as setEvalCallCollector, br as setEvalFallbackCollector, bs as setImplicationOracle, bt as shapeOfTerm, bu as shapeOnlyFn, bv as shapeToString, bw as simplifyTerm, bx as str, by as strLit, bz as substPred, bA as termEquals, bB as termToString, bC as tryRunTranspiled, bD as unknown, bE as v } from './run-2B7ohsfP.js';
3
3
  import { Node, File } from '@babel/types';
4
- import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint, v as CheckReport, N as NudoConstraint, c as ProjectionBudget } from './projection-budget-vi5Ssjdr.js';
5
- export { w as CONSTRAINT_BUILDERS, x as CONSTRAINT_BUILDER_NAMES, y as CONSTRAINT_EXPR_RE, z as CheckAction, C as CheckIssue, A as CheckJson, B as CheckJsonMulti, D as ConstraintBuilder, F as Diagnostic, G as EffectiveInterface, H as GitlabCodeQualityIssue, J as InterfaceDiag, I as InterfaceSource, K as InterfaceTierInfo, a as InterfaceTierOpts, O as NamedImport, Q as NudoField, R as NudoFnConstraint, S as NudoSidecarError, T as NudoSig, U as RefineDiag, V as RefineEntry, W as RefineResolveOpts, X as SELF, Y as actionsForIssue, Z as andC, _ as any, $ as array, a0 as boolean, a1 as checkArg, a2 as checkCall, a3 as constraintAdmitsNullish, a4 as constraintToEntryAbs, a5 as derefConstraint, a6 as drainPromiseMicros, a7 as effectiveInterface, a8 as enterPromiseExecutorScope, a9 as evalPromiseCtor, aa as evalPromiseMethod, ab as evalPromiseStatic, ac as execNudoModule, ad as extractDeclaredThrows, ae as extractFnBudget, af as extractNudoImports, ag as extractRefineReturnFromSource, ah as extractRefinesFromSource, ai as fn, aj as fnConstraintToEntryReqs, ak as formatCheckReport, al as formatConstraint, am as formatDiagnostics, an as formatEffectiveInterfaceDisplay, ao as formatGithubAnnotations, ap as formatGitlabCodeQuality, aq as formatInterfaceTierLine, ar as generatedExportNames, as as getParseSourceCacheSize, at as getTerm, au as instantiateConstraint, av as interfaceDiagCount, aw as interfaceSourceOf, ax as interfaceTierOf, ay as isIntFlag, az as isNodeModulesPath, aA as isNudoConstraint, aB as lazy, aC as leavePromiseExecutorScope, aD as lenTerm, aE as litC, aF as localNamedExports, aG as notePromiseExecutorFork, aH as nullable, aI as number, aJ as omit, aK as partial, aL as pick, aM as queuePromiseMicro, aN as refineDiagCount, aO as refineToIndexedFull, aP as resetNudoModuleExecCache, aQ as resetParseSourceCache, aR as resetSidecarLoadFailureCache, aS as serializeCheckJson, aT as serializeCheckJsonMulti, aU as setInterfaceDiagCollector, aV as setRefineDiagCollector, aW as shape, aX as sidecarClosureFingerprint, aY as sidecarPathOf, aZ as string, a_ as takeInterfaceDiags, a$ as takeInterfaceDiagsSince, b0 as takeRefineDiags, b1 as takeRefineDiagsSince, b2 as throwConstraintToKinds, b3 as union } from './projection-budget-vi5Ssjdr.js';
4
+ import { p as parseSource, L as LeakBudget, E as EffectiveInterfaceOpts, b as LoadDepsFingerprint, v as CheckReport, N as NudoConstraint, c as ProjectionBudget } from './projection-budget-Bb8CYJOR.js';
5
+ export { w as CONSTRAINT_BUILDERS, x as CONSTRAINT_BUILDER_NAMES, y as CONSTRAINT_EXPR_RE, z as CheckAction, C as CheckIssue, A as CheckJson, B as CheckJsonMulti, D as ConstraintBuilder, F as Diagnostic, G as EffectiveInterface, H as GitlabCodeQualityIssue, J as InterfaceDiag, I as InterfaceSource, K as InterfaceTierInfo, a as InterfaceTierOpts, O as NamedImport, Q as NudoField, R as NudoFnConstraint, S as NudoSidecarError, T as NudoSig, U as RefineDiag, V as RefineEntry, W as RefineResolveOpts, X as SELF, Y as actionsForIssue, Z as andC, _ as any, $ as array, a0 as boolean, a1 as checkArg, a2 as checkCall, a3 as constraintAdmitsNullish, a4 as constraintToEntryAbs, a5 as derefConstraint, a6 as drainPromiseMicros, a7 as effectiveInterface, a8 as enterPromiseExecutorScope, a9 as evalPromiseCtor, aa as evalPromiseMethod, ab as evalPromiseStatic, ac as execNudoModule, ad as extractDeclaredThrows, ae as extractFnBudget, af as extractNudoImports, ag as extractRefineReturnFromSource, ah as extractRefinesFromSource, ai as fn, aj as fnConstraintToEntryReqs, ak as formatCheckReport, al as formatConstraint, am as formatDiagnostics, an as formatEffectiveInterfaceDisplay, ao as formatGithubAnnotations, ap as formatGitlabCodeQuality, aq as formatInterfaceTierLine, ar as generatedExportNames, as as getParseSourceCacheSize, at as getTerm, au as instantiateConstraint, av as interfaceDiagCount, aw as interfaceSourceOf, ax as interfaceTierOf, ay as isIntFlag, az as isNodeModulesPath, aA as isNudoConstraint, aB as lazy, aC as leavePromiseExecutorScope, aD as lenTerm, aE as litC, aF as localNamedExports, aG as notePromiseExecutorFork, aH as nullable, aI as number, aJ as omit, aK as partial, aL as pick, aM as queuePromiseMicro, aN as refineDiagCount, aO as refineToIndexedFull, aP as resetNudoModuleExecCache, aQ as resetParseSourceCache, aR as resetSidecarLoadFailureCache, aS as serializeCheckJson, aT as serializeCheckJsonMulti, aU as setInterfaceDiagCollector, aV as setRefineDiagCollector, aW as shape, aX as sidecarClosureFingerprint, aY as sidecarPathOf, aZ as string, a_ as takeInterfaceDiags, a$ as takeInterfaceDiagsSince, b0 as takeRefineDiags, b1 as takeRefineDiagsSince, b2 as throwConstraintToKinds, b3 as union } from './projection-budget-Bb8CYJOR.js';
6
6
  export { $add, $arguments, $arr, $arrMutContainer, $arrRest, $arrWithHoles, $async, $asyncReturn, $await, $bitand, $bitnot, $bitor, $bitxor, $catchVal, $class, $classExpr, $collectionForEach, $concat, $copy, $del, $delRes, $div, $dynamicImport, $elems, $eq, $eqLoose, $fnVal, $for, $forInKeys, $forIter, $forOf, $fork, $ge, $gen, $get, $gt, $idx, $idxSet, $importMeta, $in, $instanceof, $instanceofNonIdent, $invoke, $invokeSuper, $isBreakTo, $isForkExit, $join, $le, $len, $lit, $loopBreak, $loopContinue, $loopReturn, $lt, $mod, $mul, $ne, $neLoose, $neg, $new, $not, $nullishTest, $obj, $objAccessor, $objRest, $optionalGet, $optionalInvoke, $orDefault, $pow, $pushLoopExit, $rawThis, $reStateCall, $regex, $rethrowIfNudoReturn, $set, $setKey, $shl, $shr, $spread, $staticInvoke, $sub, $super, $switch, $thisGet, $thisSet, $throw, $toNumber, $toNumeric, $tryCurrentMark, $tryDetachSoftCatch, $tryDigestSoftCatch, $tryDiscardSoft, $tryMark, $tryOrphanSoft, $tryPopMark, $tryReleaseSoftCatch, $tryReleaseSoftOut, $tryTakeSince, $typeof, $unknown, $updateAdd, $updateSub, $ushr, $while, $whileSeq, $yield, DEFAULT_MAX_LOOP_ITERS, EvalClassSpec, NudoLoopSignal, NudoReturn, NudoThrow, NudoUnsupportedError, TranspileOptions, asAbsVal, callAtFunctionBoundary, clearBClasses, clearStaleTermPred, currentExecPhi, fillTuple, foldRequireSpecArg, foldStaticStringExpr, getEvalClass, isArrMutator, isDefinitelyFalse, isDefinitelyTrue, isNudoBreak, isNudoContinue, isNudoReturn, isNudoThrow, litTruth, lookupObjAccessor, namespaceNameOf, pushLoopExit, pushThrowExit, registerEvalClass, runWithLoopExits, runtimeImportOf, takeLoopExits, takeThrowExits, transpile, transpileBodyNode, transpileExpression, transpileFile, transpileSource, withExecPhi } from './exec.js';
7
7
 
8
8
  /**
@@ -214,7 +214,7 @@ declare function instantiateReturn(fn: Abs, args: Abs[]): Abs;
214
214
  */
215
215
  type ApplyCallbackHost = (cb: Abs | {
216
216
  type: string;
217
- }, args: Abs[], env: unknown, phi: unknown, budget: unknown) => Abs;
217
+ }, args: Abs[], env: unknown, phi: unknown, budget: unknown, thisVal?: Abs) => Abs;
218
218
  /**
219
219
  * evaluator 宿主 `exec/call.ts` 加载时注册(副作用)。
220
220
  * 必须经 `exec/call.ts`(或其依赖方:exec/class、generalize)加载,
@@ -227,10 +227,10 @@ declare function setApplyCallbackHost(fn: ApplyCallbackHost): void;
227
227
  * 原始 JS 函数直调(展开实参);Abs fn 走 applyCallbackAbs(sum 分发/宿主)。
228
228
  * 求值引擎 transpile 的箭头回调是 $fnVal Abs——$fnVal.apply 自带调用边界。
229
229
  */
230
- declare function applyCallbackValue(fn: unknown, args: Abs[], env: unknown, phi: unknown, budget: unknown): Abs;
230
+ declare function applyCallbackValue(fn: unknown, args: Abs[], env: unknown, phi: unknown, budget: unknown, thisVal?: Abs): Abs;
231
231
  declare function applyCallbackAbs(cb: Abs | {
232
232
  type: string;
233
- }, args: Abs[], env: unknown, phi: unknown, budget: unknown): Abs;
233
+ }, args: Abs[], env: unknown, phi: unknown, budget: unknown, thisVal?: Abs): Abs;
234
234
  /** undefined 值的统一 Abs 表示(forEach/find 等) */
235
235
  declare function undefAbs(): Abs;
236
236
  /**
@@ -253,16 +253,6 @@ declare function asAbs(v: unknown): Abs | undefined;
253
253
  * 这是「类型即计算」的主武器——x>0 时 x+1 必须得到 >1。
254
254
  */
255
255
 
256
- /**
257
- * 抽象加法:eval(a + b) —— 跟真实 JS,不无根据地假定 number。
258
- * 1. 双方字面量 → 直接求值
259
- * 2. 双方 number prim → term + 单调性 pred,shape=number
260
- * 3. 含 string/template → 拼接
261
- * 4. any / type-var 参与 → 按 JS + 的可能结果取并集:number | string
262
- * (bool/null 走 ToNumber→number;object 默认 ToPrimitive→string;
263
- * bigint/symbol 边角不在默认并集里,由调用点实例化再收窄)
264
- * 无契约的 score(x){return x+1}:score("x") 合法,不得钉成 number。
265
- */
266
256
  declare function add(a: Abs, b: Abs, phi?: Phi): Abs;
267
257
  /** 减法:a - b = a + (-b),数值上做单调性 */
268
258
  declare function sub(a: Abs, b: Abs, phi?: Phi): Abs;
@@ -425,7 +415,7 @@ declare function evalArrayStatic(name: string, args: Abs[]): Abs | undefined;
425
415
  */
426
416
 
427
417
  declare function evalDateCtor(args: Abs[]): Abs;
428
- declare function evalDateStatic(name: string, _args: Abs[]): Abs | undefined;
418
+ declare function evalDateStatic(name: string, args: Abs[]): Abs | undefined;
429
419
  declare function evalDateMethod(name: string, recv: Abs, args: Abs[]): Abs | undefined;
430
420
 
431
421
  /**
@@ -433,7 +423,8 @@ declare function evalDateMethod(name: string, recv: Abs, args: Abs[]): Abs | und
433
423
  */
434
424
 
435
425
  declare function evalRegExpCtor(args: Abs[]): Abs;
436
- /** RegExp brand:source/flags/lastIndex 进 slots(evaluator evalRegExpCtor / $regex 共用) */
426
+ /** RegExp brand:source/flags/lastIndex + 7 标志 getter 进 slots
427
+ * (evaluator evalRegExpCtor / $regex 共用;槽构造收敛于 regexpBrandSlots) */
437
428
  declare function regexBrandAbsFrom(pattern: string, flags: string): Abs;
438
429
  /**
439
430
  * new RegExp(pattern, flags) 字面量真构造验证($new 与 evalRegExpCtor 共用):
@@ -495,7 +486,7 @@ declare function isErrorCtorName(name: string | undefined): boolean;
495
486
  declare function errorBrandAbs(name: string, args: Abs[]): Abs;
496
487
  /** new X(...) */
497
488
  declare function evalBuiltinNew(className: string, args: Abs[]): Abs | undefined;
498
- /** brand 实例方法(Date/RegExp/Map/Set) */
489
+ /** brand 实例方法(Date/RegExp/Map/Set/Error 家族/装箱拆箱后的 prim 面在外层) */
499
490
  declare function evalBuiltinInstanceMethod(brandName: string, method: string, recv: Abs, args: Abs[]): Abs | undefined;
500
491
 
501
492
  /**
package/dist/index.js CHANGED
@@ -63,7 +63,7 @@ import {
63
63
  takeInterfaceDiagsSince,
64
64
  takeRefineDiags,
65
65
  takeRefineDiagsSince
66
- } from "./chunk-UDIJKTYG.js";
66
+ } from "./chunk-PNCDILAV.js";
67
67
  import {
68
68
  $add,
69
69
  $arguments,
@@ -519,7 +519,7 @@ import {
519
519
  v,
520
520
  withExecPhi,
521
521
  withVar
522
- } from "./chunk-3SLNJPNY.js";
522
+ } from "./chunk-XR3TE4C2.js";
523
523
 
524
524
  // src/environment.ts
525
525
  function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
@@ -793,10 +793,13 @@ function isWidenedSumArm(m, parent) {
793
793
  return parent.conf === "partial" && m.shape.k === "prim" && !m.term && (!m.pred || m.pred.op === "true");
794
794
  }
795
795
  function provesBarePrimDomain(arm, constraint) {
796
+ if (constraint.members) {
797
+ return constraint.members.some((m) => provesBarePrimDomain(arm, derefConstraint(m)));
798
+ }
796
799
  if (!constraint.prim || constraint.preds.length > 0 || isIntFlag(constraint)) {
797
800
  return false;
798
801
  }
799
- if (constraint.fields || constraint.element || constraint.members || constraint.fn) {
802
+ if (constraint.fields || constraint.element || constraint.fn) {
800
803
  return false;
801
804
  }
802
805
  return arm.shape.k === "prim" && arm.shape.type === constraint.prim;
@@ -890,7 +893,29 @@ function assertImpliesSingle(arm, constraint, opts, phi) {
890
893
  if (arm.shape.k !== "arr" && arm.shape.k !== "tuple") {
891
894
  return disproved(`return shape ${arm.shape.k} \u22AD array(...)`);
892
895
  }
893
- return proved();
896
+ if (arm.shape.k === "tuple") {
897
+ const ts = arm.shape;
898
+ if (ts.rest) return unprovable("array element: rest tail not enumerable");
899
+ let sawUnprovable = false;
900
+ for (let i = 0; i < ts.elements.length; i++) {
901
+ const r2 = assertImplies(ts.elements[i], constraint.element, opts);
902
+ if (r2.status === "disproved") {
903
+ return disproved(
904
+ `array element [${i}] \u22AD ${formatConstraint(constraint.element)} (${r2.reason})`
905
+ );
906
+ }
907
+ if (r2.status === "unprovable") sawUnprovable = true;
908
+ }
909
+ return sawUnprovable ? unprovable("array element: some elements unprovable") : proved();
910
+ }
911
+ const el = arm.shape.element;
912
+ const r = assertImplies(el, constraint.element, opts);
913
+ if (r.status === "disproved") {
914
+ return disproved(
915
+ `array element \u22AD ${formatConstraint(constraint.element)} (${r.reason})`
916
+ );
917
+ }
918
+ return r.status === "unprovable" ? unprovable(`array element: ${r.reason}`) : proved();
894
919
  }
895
920
  if (constraint.fn) return proved();
896
921
  return assertScalar(arm, constraint, phi);
@@ -1,7 +1,7 @@
1
- import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-vi5Ssjdr.js';
2
- export { L as LeakBudget, b as LoadDepsFingerprint, M as MAX_PROMISE_MICROS, P as PROJECTION_MAX_DEPTH, c as ProjectionBudget, d as ProjectionStopReason, e as defaultLeakBudget, f as exceedsBudget, g as exportedNameOfLocal, h as extractAllLoadSpecs, i as getPromiseMicrosLength, l as leakIfNeeded, j as loadModuleDepsFingerprint, m as maybeLeak, n as normPath, r as resetLeakCounter, k as resolveDepPath, s as sidecarSpecsOf, o as stablePathKey, q as stablePathKeyGraph, t as termDepth, u as termNodes } from './projection-budget-vi5Ssjdr.js';
3
- import { A as Abs, T as Term, c as AstEnv } from './run-DbDRo5z6.js';
4
- export { $ as $tryDigestSoft, d as $tryMarkSoft, e as $tryReleaseSoft, E as ERROR_FAMILY, f as EvalFallbackStats, M as MayThrowEffect, g as absLit, h as absNumLit, i as absStrLit, j as allAbsStr, k as clearPureCallMemo, l as clearPureMemo, m as enterEvalCallBudgetSession, n as errorTypeAbs, o as exitEvalCallBudgetSession, p as filterDeclaredThrows, q as filterGateThrows, r as filterIgnoredThrows, s as flushMayThrowEffects, t as formatThrowsAbs, u as getEvalCallBudgetState, v as getEvalFallbackStats, w as getMayThrowCollector, x as isThrowsIgnored, y as mayThrowEffectsToAbs, z as orphanMayThrowEffects, B as popMayThrowFrame, D as pushMayThrowFrame, F as recordMayThrow, G as resetEvalFallbackStats, H as runWithMayThrowSession, I as setMayThrowCollector, J as throwAbsToKinds, K as throwsKindCovered, N as withEvalBudgetOverride } from './run-DbDRo5z6.js';
1
+ import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-Bb8CYJOR.js';
2
+ export { L as LeakBudget, b as LoadDepsFingerprint, M as MAX_PROMISE_MICROS, P as PROJECTION_MAX_DEPTH, c as ProjectionBudget, d as ProjectionStopReason, e as defaultLeakBudget, f as exceedsBudget, g as exportedNameOfLocal, h as extractAllLoadSpecs, i as getPromiseMicrosLength, l as leakIfNeeded, j as loadModuleDepsFingerprint, m as maybeLeak, n as normPath, r as resetLeakCounter, k as resolveDepPath, s as sidecarSpecsOf, o as stablePathKey, q as stablePathKeyGraph, t as termDepth, u as termNodes } from './projection-budget-Bb8CYJOR.js';
3
+ import { A as Abs, T as Term, c as AstEnv } from './run-2B7ohsfP.js';
4
+ export { $ as $tryDigestSoft, d as $tryMarkSoft, e as $tryReleaseSoft, E as ERROR_FAMILY, f as EvalFallbackStats, M as MayThrowEffect, g as absLit, h as absNumLit, i as absStrLit, j as allAbsStr, k as clearPureCallMemo, l as clearPureMemo, m as enterEvalCallBudgetSession, n as errorTypeAbs, o as exitEvalCallBudgetSession, p as filterDeclaredThrows, q as filterGateThrows, r as filterIgnoredThrows, s as flushMayThrowEffects, t as formatThrowsAbs, u as getEvalCallBudgetState, v as getEvalFallbackStats, w as getMayThrowCollector, x as isThrowsIgnored, y as mayThrowEffectsToAbs, z as orphanMayThrowEffects, B as popMayThrowFrame, D as pushMayThrowFrame, F as recordMayThrow, G as resetEvalFallbackStats, H as runWithMayThrowSession, I as setMayThrowCollector, J as throwAbsToKinds, K as throwsKindCovered, N as withEvalBudgetOverride } from './run-2B7ohsfP.js';
5
5
  import { File, Node } from '@babel/types';
6
6
 
7
7
  /**
package/dist/internal.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  stableAnalyzeKeySource,
22
22
  stablePathKey,
23
23
  stablePathKeyGraph
24
- } from "./chunk-UDIJKTYG.js";
24
+ } from "./chunk-PNCDILAV.js";
25
25
  import {
26
26
  $tryDigestSoft,
27
27
  $tryMarkSoft,
@@ -169,7 +169,7 @@ import {
169
169
  withEvalBudgetOverride,
170
170
  withFnBudgetOverride,
171
171
  wrapPromise
172
- } from "./chunk-3SLNJPNY.js";
172
+ } from "./chunk-XR3TE4C2.js";
173
173
 
174
174
  // src/algebra/inlay.ts
175
175
  function listFunctions(source) {
@@ -1,5 +1,5 @@
1
1
  import { File } from '@babel/types';
2
- import { A as Abs, T as Term, P as PrimName, a as Pred, L as LiteralValue, b as Phi, C as Confidence } from './run-DbDRo5z6.js';
2
+ import { A as Abs, T as Term, P as PrimName, a as Pred, L as LiteralValue, b as Phi, C as Confidence } from './run-2B7ohsfP.js';
3
3
 
4
4
  declare function resetParseSourceCache(): void;
5
5
  declare function getParseSourceCacheSize(): number;
@@ -206,6 +206,7 @@ type Shape = {
206
206
  k: "eff";
207
207
  eff: "promise" | "generator";
208
208
  inner: Abs;
209
+ rejected?: Abs;
209
210
  } | {
210
211
  k: "sum";
211
212
  members: Abs[];
@@ -582,6 +583,12 @@ type AbsFnImpl = {
582
583
  /** 声明时捕获的环境(闭包) */
583
584
  env?: AstEnv;
584
585
  kind?: string;
586
+ /**
587
+ * Bug 9:原生 fn.length(首个默认值/rest 形参前的形参数)——静态已知时
588
+ * 记录(宿主函数 v.length / 全 Identifier 形参的 AST),$len / $get 的
589
+ * f.length 折 exact;未记录(默认值/嵌套默认模式不可判)→ 保守 number≥0。
590
+ */
591
+ length?: number;
585
592
  /**
586
593
  * 调用时直接派发(mock withArgs 等),优先于 body。
587
594
  * 返回裸 Abs = 不抛;返回 AbsApplyResult 时 throws 面经 $call 统一路由,
@@ -639,6 +646,8 @@ declare function absFunction(params: string[], impl: Omit<AbsFnImpl, "params">,
639
646
  conf?: Confidence;
640
647
  /** Bug 9 可构造性 facet:true/false 已知,缺省未知(见 Shape k:"fn".ctor) */
641
648
  ctor?: boolean;
649
+ /** Bug 9:原生 fn.length(impl.length 落地,$len 折 exact) */
650
+ length?: number;
642
651
  }): Abs;
643
652
  /**
644
653
  * 宿主 JS 函数的可构造性(Bug 9):generator/async/async-generator 声明、
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nudojs/core",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },