-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: don't test for runtimeType equality for object comparison take 2 #192
base: master
Are you sure you want to change the base?
Conversation
as this breaks type hierarchies like `num`
d0ac6c4
to
5e1a53c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a closer look at v2.0.5 and this was not a breaking change from what I can see (runtimeType was still considered in the equality check). The new test you added fails in v2.0.5 so I don't think we should change this behavior now.
@felangel But don't you think that the behavior expressed in the new unit tests is wrong? Regardless of being introduced in 2.0.6 or not? |
@felangel equatable/lib/src/equatable_utils.dart Line 24 in 2117551
2.0.6 replaced that approach with a custom list equality logic that uses the equatable equals logic (that has the runtimeType condition) for each item. equatable/lib/src/equatable_utils.dart Line 19 in 49c8604
I added a test that works in this branch as well as on 2.0.5 but fails on 2.0.6/2.0.7 to showcase the scenario |
Sorry for the delay (I was off for a lot of the holidays). Will try to get this merged later today or tomorrow 👍 |
No problem. We have a workaround by now. |
Status
READY
Breaking Changes
NO
Description
Continuation of #188
As discussed in the referenced PR here an extended PR that adds a couple of tests to make sure that Equatable comparison still works as intended (e.g. different classes with same property values should be different) as well as adding a
very far-fetchedtest-case that simulates non-Equatable classes with custom equality logic.Related PRs
List related PRs against other branches:
Todos
Steps to Test or Reproduce
Have an Equatable class with a field that's type is using a custom equality logic
Impact to Remaining Code Base
This PR will affect: