Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Fix iterable_contains_unrelated_type #2536

Merged
merged 2 commits into from
Mar 19, 2021

Conversation

xvrh
Copy link
Contributor

@xvrh xvrh commented Mar 19, 2021

Fixes dart-lang/sdk#57708

This is an attempt to fix iterable_contains_unrelated_type. This rule works in the test suite but not with a real SDK.

This is because the [MockSdk] defines the hierarchy as List<T> implements Iterable<T> (analyzer/mock_sdk.dart) while the real SDK defines List<T> extends EfficientLengthIterable<T> (sdk/core/list.dart)

@google-cla google-cla bot added the cla: yes label Mar 19, 2021
@@ -151,12 +151,6 @@ abstract class B3 extends A3 {}

bool takesB3(B3 b) => b.contains('a'); // OK

abstract class A2 implements Iterable<String> {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remove it because this is the same case as A1 above

@coveralls
Copy link

coveralls commented Mar 19, 2021

Coverage Status

Coverage decreased (-0.03%) to 96.628% when pulling c24ef90 on xvrh:fix_iterable_contains_unrelated_type into e4ab83f on dart-lang:master.

@pq
Copy link
Contributor

pq commented Mar 19, 2021

This is because the [MockSdk] defines the hierarchy as List implements Iterable (analyzer/mock_sdk.dart) while the real SDK defines List extends EfficientLengthIterable (sdk/core/list.dart)

Ah. That's a problem.

It'd be good to get that updated. (fyi @scheglov)

Copy link
Contributor

@pq pq left a comment

Choose a reason for hiding this comment

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

💎

Thanks!

@pq pq merged commit 8c113ad into dart-archive:master Mar 19, 2021
@scheglov
Copy link
Contributor

https://dart-review.googlesource.com/c/sdk/+/192048

@xvrh xvrh deleted the fix_iterable_contains_unrelated_type branch April 3, 2021 12:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

iterable_contains_unrelated_type not working for List
5 participants