Skip to content

Commit

Permalink
Update package:collection for the new strict_top_level_inference li…
Browse files Browse the repository at this point in the history
…nt (#735)

* Update README.md

* address strict_top_level_inference diagnostics

* deprecate UnmodifiableMapMixin.first and UnmodifiableMapMixin.last

* Update unmodifiable_wrappers.dart

* ignore provide_deprecation_message diagnostics
  • Loading branch information
devoncarew authored Jan 6, 2025
1 parent 7a71ad6 commit eb74f03
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions pkgs/collection/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
`Map.entries`.
- Optimize equality and hash code for maps by using `update` and a `values`
iterator to avoid extra lookups.
- Address diagnostics from `strict_top_level_inference`.

## 1.19.1

Expand Down
2 changes: 1 addition & 1 deletion pkgs/collection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ functions on an existing object.

Please file feature requests and bugs at the [issue tracker][tracker].

[tracker]: https://github.com/dart-lang/collection/issues
[tracker]: https://github.com/dart-lang/core/issues/new/choose
16 changes: 9 additions & 7 deletions pkgs/collection/lib/src/unmodifiable_wrappers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,13 @@ abstract mixin class UnmodifiableMapMixin<K, V> implements Map<K, V> {
@override
void clear() => _throw();

/// Throws an [UnsupportedError];
/// operations that change the map are disallowed.
set first(_) => _throw();

/// Throws an [UnsupportedError];
/// operations that change the map are disallowed.
set last(_) => _throw();
/// Throws an [UnsupportedError].
// ignore: provide_deprecation_message
@deprecated
set first(Object? _) => _throw();

/// Throws an [UnsupportedError].
// ignore: provide_deprecation_message
@deprecated
set last(Object? _) => _throw();
}
2 changes: 1 addition & 1 deletion pkgs/collection/test/extensions_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2225,7 +2225,7 @@ Iterable<T> iterable<T>(Iterable<T> values) sync* {
yield* values;
}

Never unreachable([_, __, ___]) => fail('Unreachable');
Never unreachable([dynamic _, dynamic __, dynamic ___]) => fail('Unreachable');

String toString(Object? o) => '$o';

Expand Down

0 comments on commit eb74f03

Please sign in to comment.