Version 2.15.0-142.0.dev
Merge commit '6207d1da351fcbe385d09625bf4cbe31ff16aaa0' into 'dev'
diff --git a/DEPS b/DEPS
index c431fa6..9a7549d 100644
--- a/DEPS
+++ b/DEPS
@@ -45,6 +45,7 @@
# hashes. It requires access to the dart-build-access group, which EngProd
# has.
"co19_rev": "21e89324642656dcd903e97352d9d16da6a361ee",
+ # This line prevents conflicts when both packages are rolled simultaneously.
"co19_2_rev": "3e1ea1af9ef293d7f6a8f3332b5c71c7072a30e0",
# The internal benchmarks to use. See go/dart-benchmarks-internal
diff --git a/pkg/analysis_server/lib/src/cider/completion.dart b/pkg/analysis_server/lib/src/cider/completion.dart
index 458ce08..8591b99 100644
--- a/pkg/analysis_server/lib/src/cider/completion.dart
+++ b/pkg/analysis_server/lib/src/cider/completion.dart
@@ -99,7 +99,6 @@
return await manager.computeSuggestions(
performance,
completionRequest,
- enableImportedReferenceContributor: false,
enableOverrideContributor: false,
enableUriContributor: false,
);
diff --git a/pkg/analysis_server/lib/src/domains/completion/available_suggestions.dart b/pkg/analysis_server/lib/src/domains/completion/available_suggestions.dart
index e433551..1d4b4b5 100644
--- a/pkg/analysis_server/lib/src/domains/completion/available_suggestions.dart
+++ b/pkg/analysis_server/lib/src/domains/completion/available_suggestions.dart
@@ -37,9 +37,8 @@
) {
int relevance;
if (importedUriSet.contains(library.uri)) {
- return;
- }
- if (library.isDeprecated) {
+ relevance = importedRelevance;
+ } else if (library.isDeprecated) {
relevance = deprecatedRelevance;
} else {
relevance = otherwiseRelevance;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index 61eea1c..cec2be3 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -92,7 +92,6 @@
Future<List<CompletionSuggestion>> computeSuggestions(
OperationPerformanceImpl performance,
CompletionRequest request, {
- bool enableImportedReferenceContributor = true,
bool enableOverrideContributor = true,
bool enableUriContributor = true,
CompletionPreference? completionPreference,
@@ -131,7 +130,6 @@
CombinatorContributor(),
ExtensionMemberContributor(),
FieldFormalContributor(),
- if (enableImportedReferenceContributor) ImportedReferenceContributor(),
KeywordContributor(),
LabelContributor(),
LibraryMemberContributor(),
@@ -150,6 +148,8 @@
if (includedElementKinds != null) {
_addIncludedElementKinds(dartRequest);
_addIncludedSuggestionRelevanceTags(dartRequest);
+ } else {
+ contributors.add(ImportedReferenceContributor());
}
try {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart
index ba9b690..adc0a5e 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart
@@ -116,8 +116,9 @@
sourceRanges.add(sourceRange);
}
+ final uniqueSourceRanges = _uniqueSourceRanges(sourceRanges);
await builder.addDartFileEdit(file, (builder) {
- for (var sourceRange in sourceRanges) {
+ for (var sourceRange in uniqueSourceRanges) {
builder.addDeletion(sourceRange);
}
});
@@ -182,6 +183,24 @@
}
}
+ /// Return [SourceRange]s that are not covered by other in [ranges].
+ /// If there is any intersection, it must be fully covered, never partially.
+ List<SourceRange> _uniqueSourceRanges(List<SourceRange> ranges) {
+ var result = <SourceRange>[];
+ candidates:
+ for (var candidate in ranges) {
+ for (var other in ranges) {
+ if (identical(candidate, other)) {
+ continue;
+ } else if (candidate.coveredBy(other)) {
+ continue candidates;
+ }
+ }
+ result.add(candidate);
+ }
+ return result;
+ }
+
/// Return an instance of this class. Used as a tear-off in `FixProcessor`.
static RemoveUnusedField newInstance() => RemoveUnusedField();
}
diff --git a/pkg/analysis_server/test/client/completion_driver_test.dart b/pkg/analysis_server/test/client/completion_driver_test.dart
index d122baf..3f888c5 100644
--- a/pkg/analysis_server/test/client/completion_driver_test.dart
+++ b/pkg/analysis_server/test/client/completion_driver_test.dart
@@ -71,7 +71,6 @@
}
void assertSuggestion({
- bool allowMultiple = false,
required String completion,
ElementKind? element,
CompletionSuggestionKind? kind,
@@ -79,7 +78,6 @@
}) {
expect(
suggestionWith(
- allowMultiple: allowMultiple,
completion: completion,
element: element,
kind: kind,
@@ -184,7 +182,6 @@
completion: completion, element: element, kind: kind, file: file));
CompletionSuggestion suggestionWith({
- bool allowMultiple = false,
required String completion,
ElementKind? element,
CompletionSuggestionKind? kind,
@@ -192,9 +189,7 @@
}) {
final matches = suggestionsWith(
completion: completion, element: element, kind: kind, file: file);
- if (!allowMultiple) {
- expect(matches, hasLength(1));
- }
+ expect(matches, hasLength(1));
return matches.first;
}
@@ -269,10 +264,7 @@
}
''');
- // TODO(brianwilkerson) There should be a single suggestion here after we
- // figure out how to stop the duplication.
assertSuggestion(
- allowMultiple: true,
completion: 'A',
element: ElementKind.CONSTRUCTOR,
kind: CompletionSuggestionKind.INVOCATION);
@@ -296,11 +288,7 @@
^
}
''');
-
- // TODO(brianwilkerson) There should be a single suggestion here after we
- // figure out how to stop the duplication.
assertSuggestion(
- allowMultiple: true,
completion: 'E.e',
element: ElementKind.ENUM_CONSTANT,
kind: CompletionSuggestionKind.INVOCATION);
@@ -325,10 +313,7 @@
}
''');
- // TODO(brianwilkerson) There should be a single suggestion here after we
- // figure out how to stop the duplication.
assertSuggestion(
- allowMultiple: true,
completion: 'A.a',
element: ElementKind.CONSTRUCTOR,
kind: CompletionSuggestionKind.INVOCATION);
@@ -661,15 +646,13 @@
}
''');
- // TODO(brianwilkerson) There should be a single suggestion here after we
- // figure out how to stop the duplication.
expect(
suggestionsWith(
completion: 'Future.value',
file: '/sdk/lib/async/async.dart',
element: ElementKind.CONSTRUCTOR,
kind: CompletionSuggestionKind.INVOCATION),
- hasLength(2));
+ hasLength(1));
}
Future<void> test_sdk_lib_suggestions() async {
diff --git a/pkg/analysis_server/test/lsp/completion_dart_test.dart b/pkg/analysis_server/test/lsp/completion_dart_test.dart
index 0328fa0..9ccf020 100644
--- a/pkg/analysis_server/test/lsp/completion_dart_test.dart
+++ b/pkg/analysis_server/test/lsp/completion_dart_test.dart
@@ -1560,7 +1560,7 @@
expect(completions, hasLength(1));
final resolved = await resolveCompletion(completions.first);
// It should not include auto-import text since it's already imported.
- expect(resolved.detail, isNot(contains('Auto import from')));
+ expect(resolved.detail, isNull);
}
Future<void> test_suggestionSets_filtersOutAlreadyImportedSymbols() async {
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/bool_assignment_test.dart b/pkg/analysis_server/test/services/completion/dart/relevance/bool_assignment_test.dart
index b796a44..039c915 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/bool_assignment_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/bool_assignment_test.dart
@@ -15,13 +15,7 @@
@reflectiveTest
class BoolAssignmentTest extends CompletionRelevanceTest {
- @failingTest
Future<void> test_boolLiterals_imported() async {
- // TODO(brianwilkerson) This test is arguably invalid given that there's no
- // data to suggest that the boolean keywords should appear before a
- // constructor in the list, but it does seem likely to be valid in this
- // case, so we should investigate features that might cause this test to
- // start passing again.
await addTestFile('''
foo() {
bool b;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart
index b0ca4c6..8524de5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart
@@ -192,6 +192,23 @@
''');
}
+ Future<void> test_unusedField_notUsed_assign_nested() async {
+ await resolveTestCode(r'''
+class A {
+ var _f;
+ main() {
+ _f = () { _f = 0; };
+ }
+}
+''');
+ await assertHasFix(r'''
+class A {
+ main() {
+ }
+}
+''');
+ }
+
Future<void> test_unusedField_notUsed_compoundAssign() async {
await resolveTestCode(r'''
class A {
diff --git a/sdk/lib/core/print.dart b/sdk/lib/core/print.dart
index d88ea7f..460a852 100644
--- a/sdk/lib/core/print.dart
+++ b/sdk/lib/core/print.dart
@@ -6,7 +6,7 @@
/// Prints a string representation of the object to the console.
void print(Object? object) {
- String line = object.toString();
+ String line = checkNotNullable(object.toString(), "object.toString()");
var toZone = printToZone;
if (toZone == null) {
printToConsole(line);
diff --git a/sdk/lib/internal/internal.dart b/sdk/lib/internal/internal.dart
index 71f02d9..e7fd45a 100644
--- a/sdk/lib/internal/internal.dart
+++ b/sdk/lib/internal/internal.dart
@@ -749,8 +749,7 @@
class NotNullableError<T> extends Error implements TypeError {
final String _name;
NotNullableError(this._name);
- String toString() =>
- "Null is not a valid value for the parameter '$_name' of type '$T'";
+ String toString() => "Null is not a valid value for '$_name' of type '$T'";
}
/// A function that returns the value or default value (if invoked with `null`
diff --git a/tests/co19/update.sh b/tests/co19/update.sh
index 85e8019..abce487 100755
--- a/tests/co19/update.sh
+++ b/tests/co19/update.sh
@@ -18,7 +18,7 @@
NEW=$(cd $CO19 && git fetch origin && git rev-parse origin/master)
git fetch origin
-git branch cl-co19-roll-co19-to-$NEW origin/master
+git branch cl-co19-roll-co19-to-$NEW origin/main
git checkout cl-co19-roll-co19-to-$NEW
# Build a cipd package of the commit.
@@ -50,7 +50,7 @@
"$(printf "[co19] Roll co19 to $NEW\n\n" \
&& cd $CO19 \
&& git log --date='format:%Y-%m-%d' --pretty='format:%ad %ae %s' $OLD..$NEW \
- | tr -d '#' \
+ | sed 's/\#/dart-lang\/co19\#/g' \
&& printf "\nCq-Include-Trybots: dart/try:$BUILDERS\n")"
rm -rf tests/co19/src.git
diff --git a/tests/co19_2/update.sh b/tests/co19_2/update.sh
index 3bac8ab..b70d919 100755
--- a/tests/co19_2/update.sh
+++ b/tests/co19_2/update.sh
@@ -18,7 +18,7 @@
NEW=$(cd $CO19 && git fetch origin && git rev-parse origin/pre-nnbd)
git fetch origin
-git branch cl-co19-roll-co19-to-$NEW origin/master
+git branch cl-co19-roll-co19-to-$NEW origin/main
git checkout cl-co19-roll-co19-to-$NEW
# Build a cipd package of the commit.
@@ -33,32 +33,32 @@
# Update DEPS:
gclient setdep --var=co19_2_rev=$NEW
+BUILDERS=$(jq -r '.builder_configurations
+ | map(select(.steps
+ | any(.arguments
+ | select(.!=null)
+ | any(test("co19_2($|(/.*))")))))
+ | map(.builders)
+ | flatten
+ | sort
+ | .[] += "-try"
+ | join(",")' \
+ tools/bots/test_matrix.json)
+
# Make a nice commit. Don't include the '#' character to avoid referencing Dart
# SDK issues.
git commit DEPS -m \
- "$(printf "[co19] Roll co19_2 to $NEW\n\n" &&
- cd $CO19 &&
- git log --date='format:%Y-%m-%d' --pretty='format:%ad %ae %s' \
- $OLD..$NEW | tr -d '#')"
+ "$(printf "[co19] Roll co19_2 to $NEW\n\n" \
+ && cd $CO19 \
+ && git log --date='format:%Y-%m-%d' --pretty='format:%ad %ae %s' $OLD..$NEW \
+ | sed 's/\#/dart-lang\/co19\#/g' \
+ && printf "\nCq-Include-Trybots: dart/try:$BUILDERS\n")"
rm -rf tests/co19_2/src.git
GIT_EDITOR=true git cl upload
ISSUE=$(git config --get branch.cl-co19-roll-co19-to-$NEW.gerritissue)
-BUILDERS=$(jq '.builder_configurations|
- map(select(.steps|
- any(.arguments|
- select(.!=null)|
- any(.=="co19_2"))))|
- map(.builders)|
- flatten|
- sort' \
- tools/bots/test_matrix.json \
- | tr -d '[",]')
-
-git cl try -B dart/try $(for BUILDER in $BUILDERS; do echo -b $BUILDER-try; done)
-
git cl web
set +x
diff --git a/tools/VERSION b/tools/VERSION
index aa58cf1..84ea1f9 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 141
+PRERELEASE 142
PRERELEASE_PATCH 0
\ No newline at end of file