fix: don't test for runtimeType equality for object comparison take 2#192
fix: don't test for runtimeType equality for object comparison take 2#192devmil wants to merge 6 commits intofelangel:masterfrom
Conversation
as this breaks type hierarchies like `num`
d0ac6c4 to
5e1a53c
Compare
There was a problem hiding this comment.
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. |
Yeah need to double check if this issue exists in the v3.0.0-dev release (macros rewrite). If not, we can fix it in the v3.0.0 pre-release 👍 Glad you have a workaround 😄 |
|
are there any updates planned on this ? |
Planning to get this merged shortly -- apologies for the delay! I just need to carefully think through the v3.0.0 migration now that macros aren't shipping anymore 😢 |
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: