f1843b0abe
This logic allows us to migrate code like this:
int firstEven(Iterable<int> values)
=> values.firstWhere((i) => i.isEven, orElse: () => null);
Into:
import 'package:collection/collection.dart' show IterableExtension;
int? firstEven(Iterable<int> values)
=> values.firstWhereOrNull((i) => i.isEven);
Rather than the default behavior, which would migrate it to:
int? firsteven(Iterable<int?> values)
=> values.firstWhere((i) => i!.isEven, orElse: () => null);
(The new migration is far superior because it doesn't require the
input iterable to accept null).
This functionality is disabled at the moment, because:
- The changes it makes don't show up properly in the web preview.
- The pubspec is not yet properly updated.
I will address these issues in follow-up CLs and then enable the
feature.
Change-Id: I96f3b12d682c586631920b38406bad6aa3f4789e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168500
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
23 lines
877 B
Dart
23 lines
877 B
Dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
|
|
|
import 'multi_future_tracker_test.dart' as multi_future_tracker_test;
|
|
import 'scoped_set_test.dart' as scoped_set_test;
|
|
import 'source_edit_diff_formatter_test.dart'
|
|
as source_edit_diff_formatter_test;
|
|
import 'subprocess_launcher_test.dart' as subprocess_launcher_test;
|
|
import 'where_or_null_transformer_test.dart' as where_or_null_transformer_test;
|
|
|
|
main() {
|
|
defineReflectiveSuite(() {
|
|
multi_future_tracker_test.main();
|
|
scoped_set_test.main();
|
|
source_edit_diff_formatter_test.main();
|
|
subprocess_launcher_test.main();
|
|
where_or_null_transformer_test.main();
|
|
});
|
|
}
|