@nudojs/core 1.11.0 → 1.11.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.
@@ -47,7 +47,7 @@ import {
47
47
  withEvalBudgetOverride,
48
48
  withExecPhi,
49
49
  withFnBudgetOverride
50
- } from "./chunk-OYQMVCUV.js";
50
+ } from "./chunk-YRRR6AWI.js";
51
51
 
52
52
  // src/algebra/directive-scan.ts
53
53
  function cleanDirectiveLine(raw, kind) {
@@ -13857,6 +13857,10 @@ function leafGrew(acc, next) {
13857
13857
  if (aR.ok) return true;
13858
13858
  return !leqAbs(next, acc).ok;
13859
13859
  }
13860
+ function joinElems(t) {
13861
+ const parts = t.holes?.length ? [...t.elements, oobUndef()] : t.elements;
13862
+ return parts.length > 0 ? parts.reduce((x, y) => joinAbs(x, y)) : void 0;
13863
+ }
13860
13864
  function diffGrowth(acc, next) {
13861
13865
  const as = acc.shape;
13862
13866
  const ns = next.shape;
@@ -13874,7 +13878,10 @@ function diffGrowth(acc, next) {
13874
13878
  return any2 ? { slots } : null;
13875
13879
  }
13876
13880
  if (as.k === "tuple" && ns.k === "tuple") {
13877
- if (as.elements.length !== ns.elements.length) return true;
13881
+ if (as.elements.length !== ns.elements.length) {
13882
+ const g = diffGrowth(joinElems(as) ?? never, joinElems(ns) ?? never);
13883
+ return { el: g };
13884
+ }
13878
13885
  let any2 = false;
13879
13886
  const els = [];
13880
13887
  for (let i = 0; i < ns.elements.length; i++) {
@@ -13902,6 +13909,51 @@ function primTop(type) {
13902
13909
  return abs({ k: "prim", type }, void 0, void 0, "exact");
13903
13910
  }
13904
13911
  }
13912
+ function sumArrParts(s) {
13913
+ const elems = [];
13914
+ const lengths = /* @__PURE__ */ new Set();
13915
+ let hasArr = false;
13916
+ for (const m of s.members) {
13917
+ const ms = m.shape;
13918
+ if (ms.k === "tuple") {
13919
+ lengths.add(ms.elements.length);
13920
+ const e = joinElems(ms);
13921
+ if (e) elems.push(e);
13922
+ } else if (ms.k === "arr") {
13923
+ hasArr = true;
13924
+ elems.push(ms.element);
13925
+ } else {
13926
+ return { ok: false, collapse: false };
13927
+ }
13928
+ }
13929
+ return {
13930
+ ok: true,
13931
+ collapse: hasArr || lengths.size > 1,
13932
+ element: elems.length > 0 ? elems.reduce((x, y) => joinAbs(x, y)) : void 0
13933
+ };
13934
+ }
13935
+ function arrify(v2) {
13936
+ const s = v2.shape;
13937
+ if (s.k === "tuple") {
13938
+ return abs(
13939
+ { k: "arr", element: joinElems(s) ?? unknown },
13940
+ void 0,
13941
+ void 0,
13942
+ confJoin(v2.conf, "widened")
13943
+ );
13944
+ }
13945
+ if (s.k === "sum") {
13946
+ const p = sumArrParts(s);
13947
+ if (!p.ok) return void 0;
13948
+ return abs(
13949
+ { k: "arr", element: p.element ?? unknown },
13950
+ void 0,
13951
+ void 0,
13952
+ confJoin(v2.conf, "widened")
13953
+ );
13954
+ }
13955
+ return void 0;
13956
+ }
13905
13957
  function domainTop(v2) {
13906
13958
  const s = v2.shape;
13907
13959
  if (s.k === "sum" && s.members.length === 2) {
@@ -13913,6 +13965,17 @@ function domainTop(v2) {
13913
13965
  }
13914
13966
  let top;
13915
13967
  if (s.k === "sum") {
13968
+ const collapsed = arrify(v2);
13969
+ if (collapsed) {
13970
+ return confJoin22(
13971
+ abs(
13972
+ { k: "arr", element: domainTop(collapsed.shape.element) },
13973
+ void 0,
13974
+ void 0,
13975
+ collapsed.conf
13976
+ )
13977
+ );
13978
+ }
13916
13979
  let acc;
13917
13980
  for (const m of s.members) {
13918
13981
  const t = domainTop(m);
@@ -13922,15 +13985,9 @@ function domainTop(v2) {
13922
13985
  } else if (s.k === "prim") {
13923
13986
  top = primTop(s.type);
13924
13987
  } else if (s.k === "tuple") {
13925
- const els = s.elements.map((e) => domainTop(e));
13926
- const known = els.length ? els.reduce((x, y) => joinAbs(x, y)) : unknown;
13927
- top = abs(
13928
- { k: "arr", element: joinAbs(known, abs({ k: "unknown" }, { op: "lit", value: void 0 }, void 0, "partial")) },
13929
- void 0,
13930
- void 0,
13931
- "widened"
13932
- );
13933
- return top;
13988
+ const parts = s.holes?.length ? [...s.elements, oobUndef()] : s.elements;
13989
+ const known = parts.length > 0 ? parts.map((e) => domainTop(e)).reduce((x, y) => joinAbs(x, y)) : unknown;
13990
+ return abs({ k: "arr", element: known }, void 0, void 0, "widened");
13934
13991
  } else if (s.k === "arr") {
13935
13992
  top = abs({ k: "arr", element: domainTop(s.element) }, void 0, void 0, v2.conf);
13936
13993
  } else if (s.k === "obj") {
@@ -13946,6 +14003,23 @@ function confJoin22(top) {
13946
14003
  const c = confJoin(top.conf, "widened");
13947
14004
  return c === top.conf ? top : { ...top, conf: c };
13948
14005
  }
14006
+ function normalizeForWiden(v2, g) {
14007
+ if (g === null) return v2;
14008
+ const s = v2.shape;
14009
+ let target = v2;
14010
+ if (s.k === "sum" && s.members.length > 0 && s.members.every((m) => m.shape.k === "obj")) {
14011
+ target = s.members.reduce((x, y) => joinObjects(x, y));
14012
+ }
14013
+ if (g === true || !("slots" in g)) return target;
14014
+ const ts = target.shape;
14015
+ if (ts.k !== "obj") return target;
14016
+ const slots = {};
14017
+ for (const [k, slot] of Object.entries(ts.slots)) {
14018
+ const gi = g.slots[k];
14019
+ slots[k] = gi === void 0 ? slot : { ...slot, value: normalizeForWiden(slot.value, gi) };
14020
+ }
14021
+ return abs({ ...ts, slots }, void 0, void 0, target.conf);
14022
+ }
13949
14023
  function widenWithPath(v2, g) {
13950
14024
  if (g === null) return v2;
13951
14025
  if (g === true) return domainTop(v2);
@@ -13962,11 +14036,40 @@ function widenWithPath(v2, g) {
13962
14036
  const elements = s.elements.map((e, i) => widenWithPath(e, g.els[i] ?? null));
13963
14037
  return abs({ ...s, elements }, void 0, void 0, v2.conf);
13964
14038
  }
13965
- if ("el" in g && s.k === "arr") {
13966
- return abs({ k: "arr", element: widenWithPath(s.element, g.el) }, void 0, void 0, v2.conf);
14039
+ if ("el" in g) {
14040
+ const a = s.k === "arr" ? v2 : arrify(v2);
14041
+ if (a && a.shape.k === "arr") {
14042
+ return abs(
14043
+ { k: "arr", element: widenWithPath(a.shape.element, g.el) },
14044
+ void 0,
14045
+ void 0,
14046
+ a.conf
14047
+ );
14048
+ }
13967
14049
  }
13968
14050
  return domainTop(v2);
13969
14051
  }
14052
+ function collapseArrSums(v2) {
14053
+ const s = v2.shape;
14054
+ if (s.k === "sum") {
14055
+ const p = sumArrParts(s);
14056
+ if (p.ok && p.collapse && p.element) {
14057
+ return abs({ k: "arr", element: p.element }, void 0, void 0, v2.conf);
14058
+ }
14059
+ return v2;
14060
+ }
14061
+ if (s.k === "obj") {
14062
+ let changed = false;
14063
+ const slots = {};
14064
+ for (const [k, slot] of Object.entries(s.slots)) {
14065
+ const w = collapseArrSums(slot.value);
14066
+ if (w !== slot.value) changed = true;
14067
+ slots[k] = { ...slot, value: w };
14068
+ }
14069
+ return changed ? abs({ ...s, slots }, void 0, void 0, v2.conf) : v2;
14070
+ }
14071
+ return v2;
14072
+ }
13970
14073
  function makeLoopWidener() {
13971
14074
  let acc;
13972
14075
  let growth = null;
@@ -13988,7 +14091,10 @@ function makeLoopWidener() {
13988
14091
  observe(final);
13989
14092
  const base = acc ?? final;
13990
14093
  const g = interrupted ? true : growth;
13991
- return g === null ? base : widenWithPath(base, g === true ? true : g);
14094
+ if (g === null) {
14095
+ return collapseArrSums(base);
14096
+ }
14097
+ return widenWithPath(normalizeForWiden(base, g), g);
13992
14098
  }
13993
14099
  };
13994
14100
  }
@@ -15918,7 +16024,7 @@ function widenLoopJoin(a) {
15918
16024
  const known = els.length ? els.reduce((x, y) => joinAbs(x, y)) : unknown;
15919
16025
  const element = undefArms.length ? undefArms.reduce((x, y) => joinAbs(x, y), known) : known;
15920
16026
  return abs(
15921
- { k: "arr", element: joinAbs(element, oobUndef()) },
16027
+ { k: "arr", element },
15922
16028
  void 0,
15923
16029
  void 0,
15924
16030
  confJoin(v2.conf, "widened")
@@ -17379,6 +17485,7 @@ function argLacksInformation(a) {
17379
17485
  return false;
17380
17486
  }
17381
17487
  function adoptCallArgsToFaces(args, faces) {
17488
+ if (currentAssumePremises() !== pTrue) return args;
17382
17489
  const n = Math.min(args.length, faces.paramFaces.length);
17383
17490
  let changed = false;
17384
17491
  const out = args.slice();
@@ -21633,9 +21740,7 @@ function callTranspiledExportFullInner(exports, name, args, opts) {
21633
21740
  return runWithLoopExits(() => {
21634
21741
  try {
21635
21742
  const invoke = () => withNewTargetReset(() => fn2(...callArgs));
21636
- const ap = opts?.assumePremises;
21637
- const seeded = ap !== void 0 ? () => withAssumePremises(ap, invoke) : invoke;
21638
- const r = opts?.phi ? withExecPhi(opts.phi, seeded) : seeded();
21743
+ const r = opts?.phi ? withExecPhi(opts.phi, invoke) : invoke();
21639
21744
  drainPromiseMicros();
21640
21745
  if (!isAbsVal(r)) return joinControlExits(asAbsVal(r));
21641
21746
  return joinControlExits(r);
package/dist/exec.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Abs, M as MayThrowEffect, b as Phi } from './run-CDBM1fJZ.js';
2
- export { W as $assignRecord, X as $call, Y as $callNamed, bI as $nodoPos, Z as $recordBinding, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, g as EvalFallbackStats, a8 as EvalPosRecord, ab as MAX_EVAL_CALL_DEPTH, ac as MAX_EVAL_TOTAL_CALLS, ad as RUNTIME_IMPORT_RE, V as RunTranspiledOptions, af as TranspiledCallResult, at as bindingsOf, aw as callTranspiledExport, ax as callTranspiledExportApply, ay as callTranspiledExportFull, l as clearPureCallMemo, m as clearPureMemo, n as enterEvalCallBudgetSession, aD as evalExprAbs, p as exitEvalCallBudgetSession, v as getEvalCallBudgetState, aG as getEvalCallCollector, w as getEvalFallbackStats, bJ as getPosCollector, aO as isAbsVal, aQ as isCjsMainRun, b5 as noteEvalCallRecord, b6 as noteEvalFallback, bn as resetEvalCallBudget, H as resetEvalFallbackStats, bK as routeApplyThrows, bo as runTranspiled, bp as runTranspiledOptionsMemoKey, bq as setEvalAssignCollector, br as setEvalBindingSink, bs as setEvalCallCollector, bt as setEvalFallbackCollector, bv as setPosCollector, bF as tryRunTranspiled, O as withEvalBudgetOverride } from './run-CDBM1fJZ.js';
1
+ import { A as Abs, M as MayThrowEffect, b as Phi } from './run-dg1bW60I.js';
2
+ export { W as $assignRecord, X as $call, Y as $callNamed, bI as $nodoPos, Z as $recordBinding, a5 as EvalAbsAssignRecord, a6 as EvalCallRecord, a7 as EvalFallback, g as EvalFallbackStats, a8 as EvalPosRecord, ab as MAX_EVAL_CALL_DEPTH, ac as MAX_EVAL_TOTAL_CALLS, ad as RUNTIME_IMPORT_RE, V as RunTranspiledOptions, af as TranspiledCallResult, at as bindingsOf, aw as callTranspiledExport, ax as callTranspiledExportApply, ay as callTranspiledExportFull, l as clearPureCallMemo, m as clearPureMemo, n as enterEvalCallBudgetSession, aD as evalExprAbs, p as exitEvalCallBudgetSession, v as getEvalCallBudgetState, aG as getEvalCallCollector, w as getEvalFallbackStats, bJ as getPosCollector, aO as isAbsVal, aQ as isCjsMainRun, b5 as noteEvalCallRecord, b6 as noteEvalFallback, bn as resetEvalCallBudget, H as resetEvalFallbackStats, bK as routeApplyThrows, bo as runTranspiled, bp as runTranspiledOptionsMemoKey, bq as setEvalAssignCollector, br as setEvalBindingSink, bs as setEvalCallCollector, bt as setEvalFallbackCollector, bv as setPosCollector, bF as tryRunTranspiled, O as withEvalBudgetOverride } from './run-dg1bW60I.js';
3
3
  import { Node, Expression, File } from '@babel/types';
4
4
 
5
5
  /**
package/dist/exec.js CHANGED
@@ -202,7 +202,7 @@ import {
202
202
  withAssumePremises,
203
203
  withEvalBudgetOverride,
204
204
  withExecPhi
205
- } from "./chunk-OYQMVCUV.js";
205
+ } from "./chunk-YRRR6AWI.js";
206
206
  export {
207
207
  $absVal,
208
208
  $add,
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { d as AstEnv, A as Abs, b as Phi, T as Term, Q as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, U as HofSite, c as AbsModuleExports, V as RunTranspiledOptions } from './run-CDBM1fJZ.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 EvalPosRecord, a9 as ImplicationOracle, aa as LitValueResult, L as LiteralValue, ab as MAX_EVAL_CALL_DEPTH, ac as MAX_EVAL_TOTAL_CALLS, P as PrimName, ad as RUNTIME_IMPORT_RE, ae as TYPEOF_NAMES, af as TranspiledCallResult, ag as TypeofName, ah as abs, ai as absFunction, aj as absOnly, ak as absToString, al as and, am as anyAbs, an as anyVar, ao as app, ap as assumeFinite, aq as attachFnImpl, ar as bigintLit, as as bindImports, at as bindingsOf, au as bool, av as boolLit, aw as callTranspiledExport, ax as callTranspiledExportApply, ay as callTranspiledExportFull, az as collectAbsExports, aA as confJoin, aB as emptyPhi, aC as eq, aD as evalExprAbs, aE as ge, aF as geNum, aG as getEvalCallCollector, aH as getFnImpl, aI as getImplicationOracle, aJ as gt, aK as gtNum, aL as hostFnCtorFacet, aM as implies, aN as isAbsApplyResult, aO as isAbsVal, aP as isBigPrim, aQ as isCjsMainRun, aR as isExactLit, aS as isNumPrim, aT as isStrPrim, aU as le, aV as leNum, aW as lit, aX as litValue, aY as lt, aZ as ltNum, a_ as makeAbsApplyResult, a$ as markPureFn, b0 as namespaceAbsOf, b1 as ne, b2 as negatePred, b3 as never, b4 as not, b5 as noteEvalCallRecord, b6 as noteEvalFallback, b7 as num, b8 as numLit, b9 as numVar, ba as obj, bb as or, bc as pFalse, bd as pTrue, be as phiAnd, bf as predEquals, bg as predToString, bh as predVars, bi as primToTypeof, bj as ptypeof, bk as pureFnNameOf, bl as relationFingerprint, bm as relationFn, bn as resetEvalCallBudget, bo as runTranspiled, bp as runTranspiledOptionsMemoKey, bq as setEvalAssignCollector, br as setEvalBindingSink, bs as setEvalCallCollector, bt as setEvalFallbackCollector, bu as setImplicationOracle, bv as setPosCollector, bw as shapeOfTerm, bx as shapeOnlyFn, by as shapeToString, bz as simplifyTerm, bA as str, bB as strLit, bC as substPred, bD as termEquals, bE as termToString, bF as tryRunTranspiled, bG as unknown, bH as v } from './run-CDBM1fJZ.js';
1
+ import { d as AstEnv, A as Abs, b as Phi, T as Term, Q as HofCollectCtx, C as Confidence, S as Shape, a as Pred, R as RelSource, U as HofSite, c as AbsModuleExports, V as RunTranspiledOptions } from './run-dg1bW60I.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 EvalPosRecord, a9 as ImplicationOracle, aa as LitValueResult, L as LiteralValue, ab as MAX_EVAL_CALL_DEPTH, ac as MAX_EVAL_TOTAL_CALLS, P as PrimName, ad as RUNTIME_IMPORT_RE, ae as TYPEOF_NAMES, af as TranspiledCallResult, ag as TypeofName, ah as abs, ai as absFunction, aj as absOnly, ak as absToString, al as and, am as anyAbs, an as anyVar, ao as app, ap as assumeFinite, aq as attachFnImpl, ar as bigintLit, as as bindImports, at as bindingsOf, au as bool, av as boolLit, aw as callTranspiledExport, ax as callTranspiledExportApply, ay as callTranspiledExportFull, az as collectAbsExports, aA as confJoin, aB as emptyPhi, aC as eq, aD as evalExprAbs, aE as ge, aF as geNum, aG as getEvalCallCollector, aH as getFnImpl, aI as getImplicationOracle, aJ as gt, aK as gtNum, aL as hostFnCtorFacet, aM as implies, aN as isAbsApplyResult, aO as isAbsVal, aP as isBigPrim, aQ as isCjsMainRun, aR as isExactLit, aS as isNumPrim, aT as isStrPrim, aU as le, aV as leNum, aW as lit, aX as litValue, aY as lt, aZ as ltNum, a_ as makeAbsApplyResult, a$ as markPureFn, b0 as namespaceAbsOf, b1 as ne, b2 as negatePred, b3 as never, b4 as not, b5 as noteEvalCallRecord, b6 as noteEvalFallback, b7 as num, b8 as numLit, b9 as numVar, ba as obj, bb as or, bc as pFalse, bd as pTrue, be as phiAnd, bf as predEquals, bg as predToString, bh as predVars, bi as primToTypeof, bj as ptypeof, bk as pureFnNameOf, bl as relationFingerprint, bm as relationFn, bn as resetEvalCallBudget, bo as runTranspiled, bp as runTranspiledOptionsMemoKey, bq as setEvalAssignCollector, br as setEvalBindingSink, bs as setEvalCallCollector, bt as setEvalFallbackCollector, bu as setImplicationOracle, bv as setPosCollector, bw as shapeOfTerm, bx as shapeOnlyFn, by as shapeToString, bz as simplifyTerm, bA as str, bB as strLit, bC as substPred, bD as termEquals, bE as termToString, bF as tryRunTranspiled, bG as unknown, bH as v } from './run-dg1bW60I.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-BB2U2rwC.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 INTERFACE_SOURCE_ABBR, K as InterfaceDiag, I as InterfaceSource, O as InterfaceTierInfo, a as InterfaceTierOpts, Q as NamedImport, R as NudoField, S as NudoFnConstraint, T as NudoSidecarError, U as NudoSig, V as RefineDiag, W as RefineEntry, X as RefineResolveOpts, Y as SELF, Z as actionsForIssue, _ as andC, $ as any, a0 as array, a1 as boolean, a2 as checkArg, a3 as checkCall, a4 as constraintAdmitsNullish, a5 as constraintToEntryAbs, a6 as derefConstraint, a7 as drainPromiseMicros, a8 as effectiveInterface, a9 as enterPromiseExecutorScope, aa as evalPromiseCtor, ab as evalPromiseMethod, ac as evalPromiseStatic, ad as execNudoModule, ae as extractDeclaredThrows, af as extractFnBudget, ag as extractNudoImports, ah as extractRefineReturnFromSource, ai as extractRefinesFromSource, aj as fn, ak as fnConstraintToEntryReqs, al as formatCheckReport, am as formatConstraint, an as formatDiagnostics, ao as formatEffectiveInterfaceDisplay, ap as formatGithubAnnotations, aq as formatGitlabCodeQuality, ar as formatInterfaceTierLine, as as generatedExportNames, at as getParseSourceCacheSize, au as getTerm, av as instantiateConstraint, aw as interfaceDiagCount, ax as interfaceSourceOf, ay as interfaceTierOf, az as isIntFlag, aA as isNodeModulesPath, aB as isNudoConstraint, aC as lazy, aD as leavePromiseExecutorScope, aE as lenTerm, aF as litC, aG as localNamedExports, aH as notePromiseExecutorFork, aI as nullable, aJ as number, aK as omit, aL as partial, aM as pick, aN as queuePromiseMicro, aO as refineDiagCount, aP as refineToIndexedFull, aQ as resetNudoModuleExecCache, aR as resetParseSourceCache, aS as resetSidecarLoadFailureCache, aT as serializeCheckJson, aU as serializeCheckJsonMulti, aV as setInterfaceDiagCollector, aW as setRefineDiagCollector, aX as shape, aY as sidecarClosureFingerprint, aZ as sidecarPathOf, a_ as string, a$ as takeInterfaceDiags, b0 as takeInterfaceDiagsSince, b1 as takeRefineDiags, b2 as takeRefineDiagsSince, b3 as throwConstraintToKinds, b4 as union } from './projection-budget-BB2U2rwC.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-B0c9KEhd.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 INTERFACE_SOURCE_ABBR, K as InterfaceDiag, I as InterfaceSource, O as InterfaceTierInfo, a as InterfaceTierOpts, Q as NamedImport, R as NudoField, S as NudoFnConstraint, T as NudoSidecarError, U as NudoSig, V as RefineDiag, W as RefineEntry, X as RefineResolveOpts, Y as SELF, Z as actionsForIssue, _ as andC, $ as any, a0 as array, a1 as boolean, a2 as checkArg, a3 as checkCall, a4 as constraintAdmitsNullish, a5 as constraintToEntryAbs, a6 as derefConstraint, a7 as drainPromiseMicros, a8 as effectiveInterface, a9 as enterPromiseExecutorScope, aa as evalPromiseCtor, ab as evalPromiseMethod, ac as evalPromiseStatic, ad as execNudoModule, ae as extractDeclaredThrows, af as extractFnBudget, ag as extractNudoImports, ah as extractRefineReturnFromSource, ai as extractRefinesFromSource, aj as fn, ak as fnConstraintToEntryReqs, al as formatCheckReport, am as formatConstraint, an as formatDiagnostics, ao as formatEffectiveInterfaceDisplay, ap as formatGithubAnnotations, aq as formatGitlabCodeQuality, ar as formatInterfaceTierLine, as as generatedExportNames, at as getParseSourceCacheSize, au as getTerm, av as instantiateConstraint, aw as interfaceDiagCount, ax as interfaceSourceOf, ay as interfaceTierOf, az as isIntFlag, aA as isNodeModulesPath, aB as isNudoConstraint, aC as lazy, aD as leavePromiseExecutorScope, aE as lenTerm, aF as litC, aG as localNamedExports, aH as notePromiseExecutorFork, aI as nullable, aJ as number, aK as omit, aL as partial, aM as pick, aN as queuePromiseMicro, aO as refineDiagCount, aP as refineToIndexedFull, aQ as resetNudoModuleExecCache, aR as resetParseSourceCache, aS as resetSidecarLoadFailureCache, aT as serializeCheckJson, aU as serializeCheckJsonMulti, aV as setInterfaceDiagCollector, aW as setRefineDiagCollector, aX as shape, aY as sidecarClosureFingerprint, aZ as sidecarPathOf, a_ as string, a$ as takeInterfaceDiags, b0 as takeInterfaceDiagsSince, b1 as takeRefineDiags, b2 as takeRefineDiagsSince, b3 as throwConstraintToKinds, b4 as union } from './projection-budget-B0c9KEhd.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
  /**
package/dist/index.js CHANGED
@@ -65,7 +65,7 @@ import {
65
65
  takeInterfaceDiagsSince,
66
66
  takeRefineDiags,
67
67
  takeRefineDiagsSince
68
- } from "./chunk-UTRLGWJL.js";
68
+ } from "./chunk-5VGO4YJT.js";
69
69
  import {
70
70
  $add,
71
71
  $arguments,
@@ -524,7 +524,7 @@ import {
524
524
  withAssumePremises,
525
525
  withExecPhi,
526
526
  withVar
527
- } from "./chunk-OYQMVCUV.js";
527
+ } from "./chunk-YRRR6AWI.js";
528
528
 
529
529
  // src/environment.ts
530
530
  function createEnvironment(parent, bindings = /* @__PURE__ */ new Map()) {
@@ -797,6 +797,17 @@ function flattenSumArms(ret) {
797
797
  function isWidenedSumArm(m, parent) {
798
798
  return (parent.conf === "partial" || m.conf === "widened") && m.shape.k === "prim" && !m.term && (!m.pred || m.pred.op === "true");
799
799
  }
800
+ function constraintMatchesStructuralArm(arm, c) {
801
+ if (c.element) return arm.shape.k === "arr" || arm.shape.k === "tuple";
802
+ if (c.fields) return arm.shape.k === "obj";
803
+ if (c.members) {
804
+ return c.members.some((m) => constraintMatchesStructuralArm(arm, derefConstraint(m)));
805
+ }
806
+ return false;
807
+ }
808
+ function isWidenedStructuralArm(arm, constraint) {
809
+ return arm.conf === "widened" && constraintMatchesStructuralArm(arm, constraint);
810
+ }
800
811
  function provesBarePrimDomain(arm, constraint) {
801
812
  if (constraint.members) {
802
813
  return constraint.members.some((m) => provesBarePrimDomain(arm, derefConstraint(m)));
@@ -855,6 +866,11 @@ function assertSumArms(arms, parent, constraint, opts, phi) {
855
866
  if (isWidenedSumArm(arm, parent) && provesBarePrimDomain(arm, constraint)) {
856
867
  continue;
857
868
  }
869
+ if (isWidenedStructuralArm(arm, constraint)) {
870
+ const r2 = assertImpliesSingle(arm, constraint, opts, phi);
871
+ if (r2.status !== "proved") sawUnprovable = true;
872
+ continue;
873
+ }
858
874
  sawUnprovable = true;
859
875
  continue;
860
876
  }
@@ -877,7 +893,7 @@ function assertImpliesSingle(arm, constraint, opts, phi) {
877
893
  if (isNullishLitAbs(arm)) {
878
894
  return constraintAdmitsNullish(constraint) ? proved() : disproved(`nullish return \u22AD ${formatConstraint(constraint)}`);
879
895
  }
880
- if (isValueSetUnknown(arm)) {
896
+ if (isValueSetUnknown(arm) && !isWidenedStructuralArm(arm, constraint)) {
881
897
  if (arm.conf === "widened" && arm.shape.k === "prim" && !arm.term && (!arm.pred || arm.pred.op === "true") && provesBarePrimDomain(arm, constraint)) {
882
898
  return proved();
883
899
  }
@@ -1,7 +1,7 @@
1
- import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-BB2U2rwC.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-BB2U2rwC.js';
3
- import { A as Abs, T as Term, c as AbsModuleExports, d as AstEnv } from './run-CDBM1fJZ.js';
4
- export { $ as $tryDigestSoft, e as $tryMarkSoft, f as $tryReleaseSoft, E as ERROR_FAMILY, g as EvalFallbackStats, M as MayThrowEffect, h as absLit, i as absNumLit, j as absStrLit, k as allAbsStr, l as clearPureCallMemo, m as clearPureMemo, n as enterEvalCallBudgetSession, o as errorTypeAbs, p as exitEvalCallBudgetSession, q as filterDeclaredThrows, r as filterGateThrows, s as filterIgnoredThrows, t as flushMayThrowEffects, u as formatThrowsAbs, v as getEvalCallBudgetState, w as getEvalFallbackStats, x as getMayThrowCollector, y as isThrowsIgnored, z as mayThrowEffectsToAbs, B as orphanMayThrowEffects, D as popMayThrowFrame, F as pushMayThrowFrame, G as recordMayThrow, H as resetEvalFallbackStats, I as runWithMayThrowSession, J as setMayThrowCollector, K as throwAbsToKinds, N as throwsKindCovered, O as withEvalBudgetOverride } from './run-CDBM1fJZ.js';
1
+ import { I as InterfaceSource, a as InterfaceTierOpts, p as parseSource, C as CheckIssue } from './projection-budget-B0c9KEhd.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-B0c9KEhd.js';
3
+ import { A as Abs, T as Term, c as AbsModuleExports, d as AstEnv } from './run-dg1bW60I.js';
4
+ export { $ as $tryDigestSoft, e as $tryMarkSoft, f as $tryReleaseSoft, E as ERROR_FAMILY, g as EvalFallbackStats, M as MayThrowEffect, h as absLit, i as absNumLit, j as absStrLit, k as allAbsStr, l as clearPureCallMemo, m as clearPureMemo, n as enterEvalCallBudgetSession, o as errorTypeAbs, p as exitEvalCallBudgetSession, q as filterDeclaredThrows, r as filterGateThrows, s as filterIgnoredThrows, t as flushMayThrowEffects, u as formatThrowsAbs, v as getEvalCallBudgetState, w as getEvalFallbackStats, x as getMayThrowCollector, y as isThrowsIgnored, z as mayThrowEffectsToAbs, B as orphanMayThrowEffects, D as popMayThrowFrame, F as pushMayThrowFrame, G as recordMayThrow, H as resetEvalFallbackStats, I as runWithMayThrowSession, J as setMayThrowCollector, K as throwAbsToKinds, N as throwsKindCovered, O as withEvalBudgetOverride } from './run-dg1bW60I.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-UTRLGWJL.js";
24
+ } from "./chunk-5VGO4YJT.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-OYQMVCUV.js";
172
+ } from "./chunk-YRRR6AWI.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-CDBM1fJZ.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-dg1bW60I.js';
3
3
 
4
4
  declare function resetParseSourceCache(): void;
5
5
  declare function getParseSourceCacheSize(): number;
@@ -840,12 +840,11 @@ type TranspiledCallResult = {
840
840
  declare function isAbsVal(v: unknown): v is Abs;
841
841
  /** 调用 runTranspiled 导出(捕获 $throw)。opts.phi:入口 Φ 种子
842
842
  * (instantiate/symbolic 的约束入口——eval 侧路径条件收窄)。
843
- * opts.assumePremises(#152 用户引理):入口前提独立槽种子——与 phi 分槽
844
- * (不随调用链继承),消费方经 currentAssumePremises() 读。
845
- * 嵌套进入(导出桥 apply)继承外层预算;仅最外层宿主入口重置。 */
843
+ * 嵌套进入(导出桥 apply)继承外层预算;仅最外层宿主入口重置。
844
+ * #152 assume 前提不设选项位:播种统一走 withAssumePremises 动态域
845
+ * 包裹(check.ts 的 runSeeded extent),单一机制无第二路径。 */
846
846
  declare function callTranspiledExportFull(exports: Record<string, unknown>, name: string, args: Abs[], opts?: {
847
847
  phi?: Phi;
848
- assumePremises?: Phi;
849
848
  }): TranspiledCallResult;
850
849
  /** 调用 runTranspiled 导出(仅结果) */
851
850
  declare function callTranspiledExport(exports: Record<string, unknown>, name: string, args: Abs[]): Abs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nudojs/core",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },