Skip to content

Related to #1164: fix errors pushed as extra func arguments - #2350

Merged
xuri merged 3 commits into
qax-os:masterfrom
Aprax14:fix-calc-error-propagation
Jul 15, 2026
Merged

Related to #1164: fix errors pushed as extra func arguments#2350
xuri merged 3 commits into
qax-os:masterfrom
Aprax14:fix-calc-error-propagation

Conversation

@Aprax14

@Aprax14 Aprax14 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

PR Details

Fix calculation error propagation in function argument expressions

Description

This fixes incorrect error propagation in prepareEvalInfixExp when an arithmetic error (e.g. #DIV/0!) occurs while evaluating an expression inside a function argument.
Previously, when calculate() returned an error, the error was pushed to argsStack (the function's argument list) instead of opfdStack (the operand stack of the current expression). This caused each failed operation to be counted as an additional argument of the enclosing function. For example, IF(C1=0,0,A1/C1+B1/C1) with C1=0 would fail with "IF accepts at most 3 arguments".

Related Issue

Related to recent PR #2348 and also related to #2344

Motivation and Context

Formulas like =IF(C1=0,0,A1/C1+B1/C1) would fail while still being a valid excel formula.

How Has This Been Tested

Added unit test

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.62%. Comparing base (1a6d13b) to head (fd33ea8).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2350   +/-   ##
=======================================
  Coverage   99.62%   99.62%           
=======================================
  Files          32       32           
  Lines       26969    26971    +2     
=======================================
+ Hits        26867    26869    +2     
  Misses         53       53           
  Partials       49       49           
Flag Coverage Δ
unittests 99.62% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xuri xuri added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 14, 2026
Comment thread calc.go
@xuri xuri added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 15, 2026
@xuri xuri added this to v2.11.1 Jul 15, 2026
@xuri xuri moved this to Bugfix in v2.11.1 Jul 15, 2026

@xuri xuri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your great work! I've made some changes based on your code branch.

@xuri
xuri merged commit 4953115 into qax-os:master Jul 15, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

Status: Bugfix

Development

Successfully merging this pull request may close these issues.

2 participants