Skip to content

Conversation

osa1
Copy link
Member

@osa1 osa1 commented Sep 22, 2025

Bug introduced in commit a4dc873, which is not released yet.

Note: operator == implementations in this package are not symmetric, but we consider that as intentional. See #910 for details.

Fixes #910.

Note: `operator ==` implementations in this package are not symmetric,
but we consider that as intentional. See dart-lang#910 for details.

Fixes dart-lang#910.
@osa1 osa1 requested a review from a team as a code owner September 22, 2025 09:33
@osa1 osa1 requested a review from lrhn September 22, 2025 09:34
Copy link

PR Health

Breaking changes ⚠️
Package Change Current Version New Version Needed Version Looking good?
fixnum Breaking 1.1.1 1.2.0-wip 2.0.0
Got "1.2.0-wip" expected >= "2.0.0" (breaking changes)
⚠️

This check can be disabled by tagging the PR with skip-breaking-check.

Changelog Entry
Package Changed Files
package:fixnum pkgs/fixnum/lib/src/int64_native.dart

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

This check can be disabled by tagging the PR with skip-changelog-check.

Coverage ✔️
File Coverage
pkgs/fixnum/lib/src/int64_native.dart 💚 96 % ⬆️ 0 %

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

This check can be disabled by tagging the PR with skip-license-check.

@osa1
Copy link
Member Author

osa1 commented Sep 22, 2025

I don't think this requires a changelog entry as it fixes a bug in an unreleased change that's already in the changelog.

expect(Int32(17), isNot(equals(16)));
expect(Int32(17), isNot(equals(Object())));
expect(Int32(17), isNot(equals(null)));
// Note: do not use `equals` matcher below as it considers exceptions as
Copy link
Member

@lrhn lrhn Sep 22, 2025

Choose a reason for hiding this comment

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

Should still be able to use it for equals/true, just not for isNot(equals(...))/false.

But I guess it's easier to just use the same approach everywhere.

(We should make a notEquals matcher, or a better not(matcher) which only negates success and failure, not throwing. If possible.)

Copy link
Member Author

Choose a reason for hiding this comment

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

The issue is in equals: dart-lang/test#2543 it swallows exceptions.

Copy link
Member

@lrhn lrhn Sep 22, 2025

Choose a reason for hiding this comment

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

Ack, so a better not wouldn't help.

Even then, exceptions in == should still cause a mismatch in equals, so the test still fails and should throw a test failure, instead of the exception that == threw itself, so equals "works". It's isNot(equals...) that won't throw, and will accept, and that is a problem.

@osa1 osa1 merged commit 7fee9c0 into dart-lang:main Sep 22, 2025
14 of 15 checks passed
@osa1 osa1 deleted the fix_equals branch September 22, 2025 12:21
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.

Int64.== shouldn't throw an exception
2 participants