Skip to content

Fix shared formula expansion for whole-row and whole-column references - #350

Merged
MathNya merged 2 commits into
MathNya:masterfrom
JunWang-Lin:fix/shared-formula-whole-row-column-refs
Jul 28, 2026
Merged

Fix shared formula expansion for whole-row and whole-column references#350
MathNya merged 2 commits into
MathNya:masterfrom
JunWang-Lin:fix/shared-formula-whole-row-column-refs

Conversation

@JunWang-Lin

Copy link
Copy Markdown
Contributor

Closes #349.

Summary

  • avoid panicking while expanding shared formulas that contain whole-column or whole-row references
  • adjust whole-column references only along the column axis and whole-row references only along the row axis
  • preserve absolute row/column locks and named ranges
  • produce #REF! when an adjusted reference moves out of bounds
  • add regression tests for cell, whole-column, and whole-row references

Root cause

Shared-formula expansion assumed every parsed reference had both a row and a column coordinate. Valid formulas such as VLOOKUP(G3,A:B,2,FALSE) contain a whole-column reference with no row coordinate, so the expansion path unwrapped None and panicked.

Validation

  • cargo +nightly fmt
  • cargo clippy --lib -- -D warnings
  • cargo test (299 passed, 23 ignored)
  • verified the original workbook formula IF(G3="","",VLOOKUP(G3,A:B,2,FALSE))

Note

The second commit restores a missing } in the existing number_formater test module on the current upstream master; without it, the repository cannot be formatted or compiled for validation.

@JunWang-Lin
JunWang-Lin marked this pull request as ready for review July 25, 2026 00:01
@MathNya

MathNya commented Jul 28, 2026

Copy link
Copy Markdown
Owner

@JunWang-Lin
Thank you for the PR.
Since there were no issues with the changes, I’ll go ahead and merge them.

@MathNya
MathNya merged commit 44dc07b into MathNya:master Jul 28, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic when expanding shared formulas with whole-column references

2 participants