Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Fix pre-existing HintCode.UNNECESSARY_TYPE_CHECK_TRUE #206

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions 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 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 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 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