Skip to content
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

Update package:collection for the new strict_top_level_inference lint #735

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
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
12 changes: 6 additions & 6 deletions pkgs/collection/lib/src/unmodifiable_wrappers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ 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();
Copy link
Contributor

@jakemac53 jakemac53 Dec 20, 2024

Choose a reason for hiding this comment

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

Technically this is breaking (statically) to remove these?

We might want to just deprecate them 🤷‍♂️ . But should at least verify we don't know of any usages (I would expect none though since nobody really uses this type directly in APIs).

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm happy to deprecate first and check for any real usage asynchronously.

/// Throws an [UnsupportedError].
@Deprecated('This will be removed at a later date.')
set first(dynamic _) => _throw();

/// Throws an [UnsupportedError];
/// operations that change the map are disallowed.
set last(_) => _throw();
/// Throws an [UnsupportedError].
@Deprecated('This will be removed at a later date.')
set last(dynamic _) => _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
Loading