Skip to content

Commit

Permalink
Fix pre-existing HintCode.UNNECESSARY_TYPE_CHECK_TRUE (dart-archive/c…
Browse files Browse the repository at this point in the history
…ollection#206)

This prepares for landing https://dart-review.googlesource.com/c/sdk/+/190360 into the analyzer.
  • Loading branch information
scheglov authored Sep 7, 2021
1 parent 15a7681 commit ae89a6a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 2 additions & 0 deletions pkgs/collection/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.16.1-dev

## 1.16.0

* Use a stable sort algorithm in the `IterableExtension.sortedBy` method.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/collection/lib/src/equality.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class EqualityBy<E, F> implements Equality<E> {
bool isValidKey(Object? o) {
if (o is E) {
final value = _comparisonKey(o);
return value is F && _inner.isValidKey(value);
return _inner.isValidKey(value);
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion pkgs/collection/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: collection
version: 1.16.0
version: 1.16.1-dev

description: Collections and utilities functions and classes related to collections.
repository: https://github.com/dart-lang/collection
Expand Down
14 changes: 6 additions & 8 deletions pkgs/collection/test/wrapper_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void main() {

test('.every', () {
expect(set.every((element) => element == 'foo'), isFalse);
expect(set.every((element) => element is String), isTrue);
expect(set.every((element) => true), isTrue);
});

test('.expand', () {
Expand All @@ -341,7 +341,7 @@ void main() {
});

test('.firstWhere', () {
expect(set.firstWhere((element) => element is String), equals('foo'));
expect(set.firstWhere((element) => true), equals('foo'));
expect(set.firstWhere((element) => element.startsWith('b')),
equals('bar'));
expect(() => set.firstWhere((element) => element is int),
Expand Down Expand Up @@ -380,7 +380,7 @@ void main() {
});

test('.lastWhere', () {
expect(set.lastWhere((element) => element is String), equals('bar'));
expect(set.lastWhere((element) => true), equals('bar'));
expect(
set.lastWhere((element) => element.startsWith('f')), equals('foo'));
expect(
Expand All @@ -403,8 +403,7 @@ void main() {
expect(() => set.singleWhere((element) => element == 'baz'),
throwsStateError);
expect(set.singleWhere((element) => element == 'foo'), 'foo');
expect(() => set.singleWhere((element) => element is String),
throwsStateError);
expect(() => set.singleWhere((element) => true), throwsStateError);
});

test('.skip', () {
Expand All @@ -418,7 +417,7 @@ void main() {
equals(['bar']));
expect(set.skipWhile((element) => element.startsWith('z')),
equals(['foo', 'bar']));
expect(set.skipWhile((element) => element is String), equals([]));
expect(set.skipWhile((element) => true), equals([]));
});

test('.take', () {
Expand All @@ -431,8 +430,7 @@ void main() {
expect(set.takeWhile((element) => element.startsWith('f')),
equals(['foo']));
expect(set.takeWhile((element) => element.startsWith('z')), equals([]));
expect(set.takeWhile((element) => element is String),
equals(['foo', 'bar']));
expect(set.takeWhile((element) => true), equals(['foo', 'bar']));
});

test('.toList', () {
Expand Down

0 comments on commit ae89a6a

Please sign in to comment.