@primmel/primmel 1.21.14 → 1.21.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/check.ts"],"names":[],"mappings":"AAmYA,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAW3B,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAsE7C,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB;yEACqE;IACrE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qDAAqD;AACrD,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAChC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AA+CD,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,YAAiB,GACzB,UAAU,EAAE,CAy1Pd;AAoBD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,EAAE,CAwFjE;AA4BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAOH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,EAAE,CAoCvE;AAUD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,EAAE,CAmFnE;AAWD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,EAAE,CA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AAQ,EAAE,QAAQ,GAAG,UAAU,EAAE,CA6FhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,EAAE,CAoBhE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,EAAE,CA8CnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,EAAE,CA0HhE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,GACjB,UAAU,EAAE,CAuNd"}
package/dist/src/check.js CHANGED
@@ -1390,9 +1390,72 @@ function checkPackage(dir, options = {}) {
1390
1390
  };
1391
1391
  kindOf(ast);
1392
1392
  };
1393
+ // the applicability guard: a boolean expression over the limit's own
1394
+ // args — the same resolution, plus the boolean top (C84's shape, the
1395
+ // guard is a predicate)
1396
+ const checkGuard = (rid, name, lim) => {
1397
+ if (!lim.when) {
1398
+ return;
1399
+ }
1400
+ const args = new Set((lim.args ?? []).map(a => a.name));
1401
+ try {
1402
+ const ast = (0, expressions_1.parseExpression)(lim.when);
1403
+ const ids = (0, expressions_1.freeIdentifiers)(ast);
1404
+ for (const call of new Set(ids.calls)) {
1405
+ if (!INLINE_FUNCTION_WORDS.has(call)) {
1406
+ err('C171', `requirement ${rid}: limit ${name}'s when-guard calls "${call}(…)", which no argument binds and which is not in the expression function vocabulary (expression-identifiers-resolve)`);
1407
+ }
1408
+ }
1409
+ for (const id of new Set(ids.names)) {
1410
+ const root = id.split('.')[0];
1411
+ if (args.has(id) ||
1412
+ (id.includes('.') &&
1413
+ (root === 'self' || CONTEXT_ROOTS.has(root) || args.has(root)))) {
1414
+ continue;
1415
+ }
1416
+ err('C171', `requirement ${rid}: limit ${name}'s when-guard names "${id}", which no argument binds (expression-identifiers-resolve)`);
1417
+ }
1418
+ const top = ast.type;
1419
+ if (!((top === 'binop' &&
1420
+ [
1421
+ '<=',
1422
+ '>=',
1423
+ '<',
1424
+ '>',
1425
+ '=',
1426
+ '!=',
1427
+ '≠',
1428
+ 'and',
1429
+ 'or',
1430
+ 'xor',
1431
+ 'implies',
1432
+ ].includes(ast.op)) ||
1433
+ (top === 'unop' && ast.op === 'not'))) {
1434
+ err('C84', `requirement ${rid}: limit ${name}'s when-guard does not evaluate to a boolean — the guard is one comparison or logical composition (constraint-shape)`);
1435
+ }
1436
+ }
1437
+ catch (e) {
1438
+ err('C171', `requirement ${rid}: limit ${name}'s when-guard does not parse — ${String(e.message ?? e)} (expression-identifiers-resolve)`);
1439
+ }
1440
+ };
1393
1441
  for (const r of standard.requirements ?? []) {
1394
1442
  if (r.limit?.argsBound) {
1395
1443
  checkInlineLimit('requirement', r.id, r.limit, null);
1444
+ checkGuard(r.id, '(the unnamed limit)', r.limit);
1445
+ }
1446
+ for (const lim of r.limits ?? []) {
1447
+ const label = lim.name ? `"${lim.name}"` : '(an unnamed limit)';
1448
+ if (lim.argsBound) {
1449
+ checkInlineLimit('requirement', r.id, lim, null);
1450
+ }
1451
+ else if (lim.expression) {
1452
+ // the named limits carry the inline carrier (the guard needs
1453
+ // the args scope; a legacy string in the list form is air)
1454
+ err('C171', `requirement ${r.id}: limit ${label} must carry the inline carrier — args { … } and expression { … } (expression-identifiers-resolve)`);
1455
+ }
1456
+ checkGuard(r.id, label, lim);
1457
+ }
1458
+ if (r.limit?.argsBound || (r.limits ?? []).length > 0) {
1396
1459
  continue;
1397
1460
  }
1398
1461
  const expr = r.limit?.expression;