Skip to content

Conversation

@natebosch
Copy link
Member

Closes #2520

A double.nan is not equal to itself with the == operator, but for
the purposes of testing it's easier to consider a NaN correct where a
NaN was expected. This matches behavior in several other testing
frameworks in other languages. This is unlikely to cause existing tests
to fail or change semantics since a test is unlikely to use non-equality
as a positive indication of a NaN result.

Closes #2520

A `double.nan` is not equal to itself with the `==` operator, but for
the purposes of testing it's easier to consider a `NaN` correct where a
`NaN` was expected. This matches behavior in several other testing
frameworks in other languages. This is unlikely to cause existing tests
to fail or change semantics since a test is unlikely to use non-equality
as a positive indication of a `NaN` result.
@natebosch natebosch requested a review from a team as a code owner July 23, 2025 22:19
@natebosch natebosch requested a review from jakemac53 July 23, 2025 22:20
@github-actions
Copy link

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

@natebosch
Copy link
Member Author

This doesn't make any internal test fail, I think it's safe to land.

@natebosch natebosch merged commit 6aeb1e4 into master Jul 24, 2025
147 of 149 checks passed
@natebosch natebosch deleted the match-nan branch July 24, 2025 17:27
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jul 30, 2025
Revisions updated by `dart tools/rev_sdk_deps.dart`.

ai (https://github.com/dart-lang/ai/compare/40607dc..7fbe88a):
  7fbe88a  2025-07-25  Jacob MacDonald  refine the prompt and fix the extension listener (dart-lang/ai#244)
  8d2384b  2025-07-25  Jacob MacDonald  add some intellij files to gitignore (dart-lang/ai#245)
  e09e469  2025-07-24  Jacob MacDonald  add prompt for using flutter driver to write a test for a user journey (dart-lang/ai#243)
  88d7a4d  2025-07-23  Jacob MacDonald  Flutter driver updates, add screenshot support back (dart-lang/ai#241)

http (https://github.com/dart-lang/http/compare/4a90d16..afda310):
  afda310  2025-07-23  Brian Quinlan  [cronet] Support aborting requests (dart-lang/http#1797)

test (https://github.com/dart-lang/test/compare/c201cc9..6aeb1e4):
  6aeb1e4f  2025-07-24  Nate Bosch  Consider NaN a match for itself (dart-lang/test#2524)
  65a37698  2025-07-23  Nate Bosch  Use latest analyzer and language version (dart-lang/test#2523)

web (https://github.com/dart-lang/web/compare/767151e..da1dd5d):
  da1dd5d  2025-07-24  Devon Carew  switch CI to using workflow files (dart-lang/web#428)
  8ffaf5e  2025-07-23  Nikechukwu  [interop] Implement Diagnostics and Handling Errors (dart-lang/web#426)

Change-Id: I499491c4c1466cb1c81cf5e4bbff4a484e880e57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442560
Auto-Submit: Devon Carew <[email protected]>
Commit-Queue: Devon Carew <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NaN values should not be compared with == by the equals matcher

3 participants