Repository navigation
Preserve array evaluation for non-spilling XLSX formulas - #83
h-a-n-a-s-h-i merged 1 commit into
Conversation
|
Thanks for picking this up. I checked this branch against Excel for Mac 16.113 (full recalculation and save) with the workbooks from #64:
So this fixes the wrong values. The trade-off: plain formulas like If you'd prefer to match Excel's own output, I have a branch that only flags formulas whose legacy reading could differ (array operands, arrays reaching single-value parameters, array results). Happy to open it as a PR, or not, as you prefer. (Separate: cached |
|
Thank you for this — the implicit-intersection concern is real ( If you haven't already, please come join us on Discord: https://discord.gg/artcraft — happy to talk any of this through there. |
5c7d609 to
eec1bfe
Compare
eec1bfe to
42854f2
Compare
|
Landed — thank you, Harrison! The narrower classifier is exactly what we asked for: only array-sensitive formulas get the dynamic-array marker, with bounded traversal and a safe fallback. Your branch doesn't allow maintainer edits, so I rebased it onto main myself and added a small fix-up (LET bindings via If you haven't already, please come join us on Discord: https://discord.gg/artcraft |
…hed values refilled on recalc) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The file format has no `@` operator, but formulas with an explicit implicit intersection were written with a literal `@` (`<f>@A1:A3*2</f>`). Excel writes `@x` as `_xlfn.SINGLE(x)`, which only dynamic-array formulas carry. The writer now does the same and marks such formulas cm="1"; the parser reads `SINGLE(x)` back as `@x`, as it already does for `ANCHORARRAY` and `#`. Two cases in the #83 metadata test expected a redundant `@` (`SQRT(@A1:A3)`, `@A1:A3*2`) to be written as an ordinary formula. Dropping the `@` there is only lossless if the reader puts it back on legacy formulas, which it doesn't yet (the read side of #64), so they now expect cm. generated with Claude Code
Addresses #64 (XLSX export).
SUM(Data!A1:A20*Data!B1:B20)can return a different value after export if Excel reads it with legacy implicit intersection. This preserves array evaluation for formulas that need it without converting every ordinary formula into a single-cell array.The export-only classifier follows range/array operands, scalar function arguments, scoped names, structured references and indirect references.
SUM(A1:A20),A1*2, ordinary table-row formulas and legacy array-awareSUMPRODUCTexpressions remain ordinary formulas. Array-sensitive expressions receivecm="1"and an array reference; actual spills and legacy CSE arrays keep their respective representations. Explicit@scalarizes its result while retaining any array-sensitive operations inside it. Analysis is bounded and conservative for unresolved reference dimensions; it does not evaluate formulas or change import behavior.Rebased onto main at
1ded850, including #85. Its#SPILL!/#CALC!→#VALUE!cached-error behavior and regression coverage remain intact.Validation:
cargo xtask cistops at the existingcore/src/date.rs:108Clippy error. Scoped XLSX Clippy stops only at the existingsheet_read.rs:146diagnostic; no suppressions added.Excel-native recalculation was not run for this revision, and exact metadata parity for every function is not claimed. The reading-side legacy semantics in #64 remain separate. Policy and boundaries are documented in
docs/decisions.md.