-
-
Notifications
You must be signed in to change notification settings - Fork 286
Fix EqualUnmodifiableListView equality comparison (Fixes #1308) #1310
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 EqualUnmodifiableListView equality comparison (Fixes #1308) #1310
Conversation
WalkthroughEquality and hashCode implementations for unmodifiable collection views were changed to use deep collection equality; code generation templates were updated to propagate an Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Generator as Freezed Generator
participant MethodsBuilder as methods(...)
participant HashBuilder as hashCodeMethod(...)
note right of Generator: When generating concrete classes
Generator->>MethodsBuilder: call methods(..., isConst: constructor.isConst)
MethodsBuilder-->>Generator: emitted methods (use isConst to choose constness)
Generator->>HashBuilder: call hashCodeMethod(..., source: source, isConst: isConst)
alt isConst or source is mixin
HashBuilder-->>Generator: emit direct Object.hash / expression (no cached field)
else not const and not mixin
alt single property
HashBuilder-->>Generator: emit simple Object.hash expression
else many properties
HashBuilder-->>Generator: emit cached _cachedHashCode using hashAll/hash expression
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (2 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes #1308 - EqualUnmodifiableListView does not correctly override ==
Changes
EqualUnmodifiableListView,EqualUnmodifiableSetView, andEqualUnmodifiableMapViewto useDeepCollectionEqualityfor content-based comparisonImpact
This resolves the inconsistency where:
Listobjects compared by contentListproperties compared by object referenceNow both scenarios use content-based comparison, making the behavior consistent and fixing the Riverpod
ref.watch(Provider).select()issue.Changes
Before:
After:
Summary by CodeRabbit