Skip to content

This closes #2448, fix incorrect equality result for a number and text operand - #2454

Open
PhilflowIO wants to merge 1 commit into
qax-os:masterfrom
PhilflowIO:2448-equality-type-mismatch
Open

PhilflowIO wants to merge 1 commit into
qax-os:masterfrom
PhilflowIO:2448-equality-type-mismatch

Conversation

@PhilflowIO

Copy link
Copy Markdown
Contributor

PR Details

Description

Adds the helper numberTextMismatch and calls it from calcEq and calcNEq. When one operand is a number and the other one is text, = returns FALSE and <> returns TRUE instead of falling through to the comparison of the formatted values.

The helper is declared above calcEq and reads only Type and the logical flag. It is called after the existing text against text branch, so strings.EqualFold keeps handling that case and "a"="A" stays TRUE. A logical value is excluded, it reaches the comparison as a number holding the logical flag and its behaviour is unchanged.

Related Issue

Closes #2448

Motivation and Context

rOpd.Value() == lOpd.Value() cannot tell the number 1 from the text "1", because both format to 1. Excel 365 (Excel for the web, 16.0300) returns FALSE for 1="1" and TRUE for 1<>"1". The ordering operators <, <=, > and >= already have the type branches for this; only = and <> were missing them.

How Has This Been Tested

Cases added to TestCalcCellValue: 1="1", "1"=1, 1<>"1", 1.5="1.5", 100="100", A1="1", A1<>"1", (1="1")*1, IF(1="1","equal","notequal"), plus the unchanged boundaries "a"="A", 0="", TRUE=1 and the result type assertions ISNUMBER(1="1"), ISLOGICAL(1="1"), ISTEXT(1="1"). The existing expectations for the ordering operators, for text against text and for number against number are unchanged.

go test ./... passes on go1.26.9 linux/amd64. go vet ./... is clean and gofmt -s -l . is empty.

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 Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.72%. Comparing base (402e3bd) to head (b085f90).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2454   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          32       32           
  Lines       32554    32568   +14     
=======================================
+ Hits        32464    32478   +14     
  Misses         88       88           
  Partials        2        2           
Flag Coverage Δ
unittests 99.72% <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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A number and a text are treated as equal by = and <>

2 participants