@mark1russell7/vex-compiler 0.12.0 → 0.13.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/vex-compiler",
4
- "version": "0.12.0",
4
+ "version": "0.13.0",
5
5
  "description": "The Vex compiler: generated JavaScript for Vex programs, at run time and at build time, with the results of the interpreter.",
6
6
  "keywords": [
7
7
  "vex",
@@ -43,15 +43,15 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@mark1russell7/cue": "github:mark1russell7/cue",
46
- "@mark1russell7/vex-domains": "0.12.0",
47
- "@mark1russell7/vex-testkit": "0.12.0",
46
+ "@mark1russell7/vex-domains": "0.13.0",
47
+ "@mark1russell7/vex-testkit": "0.13.0",
48
48
  "@types/node": "^26.6.4",
49
49
  "fast-check": "^4.10.2",
50
50
  "typescript": "^7.0.2",
51
51
  "vitest": "^5.0.3"
52
52
  },
53
53
  "dependencies": {
54
- "@mark1russell7/vex": "0.12.0"
54
+ "@mark1russell7/vex": "0.13.0"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "tsdown",
package/src/module.ts CHANGED
@@ -1817,7 +1817,9 @@ class Printer {
1817
1817
  const testCodes = tests.map((t) => this.#hoist(this.expr(t, inner), hasLoop(t)));
1818
1818
  const body = this.#hoist(this.expr(target.body, inner), hasLoop(target.body));
1819
1819
  // A count of all the items, whose body cannot fail, is the count of the records. A safe body covers its statements.
1820
- if (op === "count" && fixed && tests.length === 0 && body.v.safe) return bare(plainValue("n", "number"));
1820
+ // V-063: a body that reads a cell keeps its loop. The search of the run must see each read, so a cell that reads
1821
+ // itself gives `#CYCLE!`.
1822
+ if (op === "count" && fixed && tests.length === 0 && body.v.safe && !body.v.deps.has(CELLS)) return bare(plainValue("n", "number"));
1821
1823
  const deps = new Set([...start, ...[body, ...testCodes].flatMap((x) => [...x.v.deps])].filter((d) => d !== level));
1822
1824
  const r = this.#reduction(op, body.v.kind);
1823
1825
  const { v } = r;