Migrate remaining unblocked tests
Change-Id: I30e3c22db7df6e78be88125f20eea2dce054f446
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/test/analysis/get_navigation_test.dart b/pkg/analysis_server/test/analysis/get_navigation_test.dart
index 99943b9..38def2f 100644
--- a/pkg/analysis_server/test/analysis/get_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/get_navigation_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/domain_analysis.dart';
@@ -94,9 +92,10 @@
var request = _createGetNavigationRequest(file, 0, 100);
var response = await serverChannel.sendRequest(request);
expect(response.error, isNull);
- expect(response.result['files'], isEmpty);
- expect(response.result['targets'], isEmpty);
- expect(response.result['regions'], isEmpty);
+ var result = response.result!;
+ expect(result['files'], isEmpty);
+ expect(result['targets'], isEmpty);
+ expect(result['regions'], isEmpty);
}
Future<void> test_fileOutsideOfRoot() async {
diff --git a/pkg/analysis_server/test/analysis/test_all.dart b/pkg/analysis_server/test/analysis/test_all.dart
index 8954813..1187065 100644
--- a/pkg/analysis_server/test/analysis/test_all.dart
+++ b/pkg/analysis_server/test/analysis/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'get_errors_test.dart' as get_errors;
diff --git a/pkg/analysis_server/test/client/completion_driver_test.dart b/pkg/analysis_server/test/client/completion_driver_test.dart
index 4d6ee60..86d1fbb 100644
--- a/pkg/analysis_server/test/client/completion_driver_test.dart
+++ b/pkg/analysis_server/test/client/completion_driver_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/services/completion/dart/utilities.dart';
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
@@ -23,9 +21,9 @@
}
abstract class AbstractCompletionDriverTest with ResourceProviderMixin {
- CompletionDriver driver;
- Map<String, String> packageRoots;
- List<CompletionSuggestion> suggestions;
+ late CompletionDriver driver;
+ Map<String, String> packageRoots = {};
+ late List<CompletionSuggestion> suggestions;
String get projectName => 'project';
@@ -47,7 +45,7 @@
}
Future<List<CompletionSuggestion>> addTestFile(String content,
- {int offset}) async {
+ {int? offset}) async {
driver.addTestFile(content, offset: offset);
await getSuggestions();
// For sanity, ensure that there are no errors recorded for project files
@@ -57,10 +55,10 @@
}
void assertNoSuggestion({
- @required String completion,
- ElementKind element,
- CompletionSuggestionKind kind,
- String file,
+ required String completion,
+ ElementKind? element,
+ CompletionSuggestionKind? kind,
+ String? file,
}) {
expect(
suggestionsWith(
@@ -73,10 +71,10 @@
}
void assertSuggestion({
- @required String completion,
- ElementKind element,
- CompletionSuggestionKind kind,
- String file,
+ required String completion,
+ ElementKind? element,
+ CompletionSuggestionKind? kind,
+ String? file,
}) {
expect(
suggestionWith(
@@ -89,10 +87,10 @@
}
void assertSuggestions({
- @required String completion,
- ElementKind element,
- CompletionSuggestionKind kind,
- String file,
+ required String completion,
+ ElementKind? element,
+ CompletionSuggestionKind? kind,
+ String? file,
}) {
expect(
suggestionWith(
@@ -129,7 +127,7 @@
suggestions.sort(completionComparator);
for (var s in suggestions) {
print(
- '[${s.relevance}] ${s.completion} • ${s.element?.kind?.name ?? ""} ${s.kind.name} ${s.element?.location?.file ?? ""}');
+ '[${s.relevance}] ${s.completion} • ${s.element?.kind.name ?? ""} ${s.kind.name} ${s.element?.location?.file ?? ""}');
}
}
@@ -152,10 +150,10 @@
}
SuggestionMatcher suggestionHas({
- @required String completion,
- ElementKind element,
- CompletionSuggestionKind kind,
- String file,
+ required String completion,
+ ElementKind? element,
+ CompletionSuggestionKind? kind,
+ String? file,
}) =>
(CompletionSuggestion s) {
if (s.completion != completion) {
@@ -175,19 +173,19 @@
};
Iterable<CompletionSuggestion> suggestionsWith({
- @required String completion,
- ElementKind element,
- CompletionSuggestionKind kind,
- String file,
+ required String completion,
+ ElementKind? element,
+ CompletionSuggestionKind? kind,
+ String? file,
}) =>
suggestions.where(suggestionHas(
completion: completion, element: element, kind: kind, file: file));
CompletionSuggestion suggestionWith({
- @required String completion,
- ElementKind element,
- CompletionSuggestionKind kind,
- String file,
+ required String completion,
+ ElementKind? element,
+ CompletionSuggestionKind? kind,
+ String? file,
}) {
final matches = suggestionsWith(
completion: completion, element: element, kind: kind, file: file);
diff --git a/pkg/analysis_server/test/client/impl/completion_driver.dart b/pkg/analysis_server/test/client/impl/completion_driver.dart
index a4569aa..48a7ef0 100644
--- a/pkg/analysis_server/test/client/impl/completion_driver.dart
+++ b/pkg/analysis_server/test/client/impl/completion_driver.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'dart:async';
import 'dart:math' as math;
@@ -73,18 +71,18 @@
final Map<String, List<AnalysisError>> filesErrors = {};
- String completionId;
- int completionOffset;
- int replacementOffset;
- int replacementLength;
+ late String completionId;
+ late int completionOffset;
+ late int replacementOffset;
+ late int replacementLength;
CompletionDriver({
- @required this.supportsAvailableSuggestions,
- AnalysisServerOptions serverOptions,
- @required MemoryResourceProvider resourceProvider,
- @required String projectPath,
- @required String testFilePath,
- }) : _resourceProvider = resourceProvider,
+ required this.supportsAvailableSuggestions,
+ AnalysisServerOptions? serverOptions,
+ required MemoryResourceProvider resourceProvider,
+ required String projectPath,
+ required String testFilePath,
+ }) : _resourceProvider = resourceProvider,
super(
serverOptions: serverOptions ?? AnalysisServerOptions(),
projectPath: resourceProvider.convertPath(projectPath),
@@ -95,7 +93,7 @@
MemoryResourceProvider get resourceProvider => _resourceProvider;
@override
- String addTestFile(String content, {int offset}) {
+ String addTestFile(String content, {int? offset}) {
completionOffset = content.indexOf('^');
if (offset != null) {
expect(completionOffset, -1, reason: 'cannot supply offset and ^');
@@ -110,7 +108,7 @@
}
@override
- void createProject({Map<String, String> packageRoots}) {
+ void createProject({Map<String, String>? packageRoots}) {
super.createProject(packageRoots: packageRoots);
if (supportsAvailableSuggestions) {
var request = CompletionSetSubscriptionsParams(
@@ -133,7 +131,7 @@
}
@override
- File newFile(String path, String content, [int stamp]) => resourceProvider
+ File newFile(String path, String content, [int? stamp]) => resourceProvider
.newFile(resourceProvider.convertPath(path), content, stamp);
@override
@@ -190,12 +188,12 @@
var importedSets = <IncludedSuggestionSet>[];
var notImportedSets = <IncludedSuggestionSet>[];
- for (var set in params.includedSuggestionSets) {
+ for (var set in params.includedSuggestionSets!) {
var id = set.id;
while (!idToSetMap.containsKey(id)) {
await Future.delayed(const Duration(milliseconds: 1));
}
- var suggestionSet = idToSetMap[id];
+ var suggestionSet = idToSetMap[id]!;
if (importedLibraryUris.contains(suggestionSet.uri)) {
importedSets.add(set);
} else {
@@ -212,7 +210,7 @@
void addSuggestion(
AvailableSuggestion suggestion, IncludedSuggestionSet includeSet) {
var kind = suggestion.element.kind;
- if (!includedKinds.contains(kind)) {
+ if (!includedKinds!.contains(kind)) {
return;
}
var completionSuggestion =
@@ -229,7 +227,7 @@
'${s.declaringLibraryUri}:${s.element.kind}:${s.label}';
for (var includeSet in importedSets) {
- var set = idToSetMap[includeSet.id];
+ var set = idToSetMap[includeSet.id]!;
for (var suggestion in set.items) {
if (seenElements.add(suggestionId(suggestion))) {
addSuggestion(suggestion, includeSet);
@@ -238,7 +236,7 @@
}
for (var includeSet in notImportedSets) {
- var set = idToSetMap[includeSet.id];
+ var set = idToSetMap[includeSet.id]!;
for (var suggestion in set.items) {
if (!seenElements.contains(suggestionId(suggestion))) {
addSuggestion(suggestion, includeSet);
@@ -252,11 +250,11 @@
var params = CompletionAvailableSuggestionsParams.fromNotification(
notification,
);
- for (var set in params.changedLibraries) {
+ for (var set in params.changedLibraries!) {
idToSetMap[set.id] = set;
uriToSetMap[set.uri] = set;
}
- for (var id in params.removedLibraries) {
+ for (var id in params.removedLibraries!) {
var set = idToSetMap.remove(id);
uriToSetMap.remove(set?.uri);
}
diff --git a/pkg/analysis_server/test/client/test_all.dart b/pkg/analysis_server/test/client/test_all.dart
index 7887a9d..417c4d3 100644
--- a/pkg/analysis_server/test/client/test_all.dart
+++ b/pkg/analysis_server/test/client/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'completion_driver_test.dart' as completion_driver;
diff --git a/pkg/analysis_server/test/completion_test.dart b/pkg/analysis_server/test/completion_test.dart
index 4cefdef..eaf324a 100644
--- a/pkg/analysis_server/test/completion_test.dart
+++ b/pkg/analysis_server/test/completion_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'dart:collection';
import 'package:test/test.dart';
@@ -2418,7 +2416,7 @@
/// expected to fail. This should be used to mark known completion bugs that
/// have not yet been fixed.
void buildTests(String baseName, String originalSource, List<String> results,
- {Map<String, String> extraFiles, String failingTests = ''}) {
+ {Map<String, String>? extraFiles, String failingTests = ''}) {
var completionTests = LocationSpec.from(originalSource, results);
completionTests.sort((LocationSpec first, LocationSpec second) {
return first.id.compareTo(second.id);
diff --git a/pkg/analysis_server/test/completion_test_support.dart b/pkg/analysis_server/test/completion_test_support.dart
index 83a70c8..0e63271 100644
--- a/pkg/analysis_server/test/completion_test_support.dart
+++ b/pkg/analysis_server/test/completion_test_support.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'dart:collection';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
@@ -20,7 +18,7 @@
.toList();
void assertHasCompletion(String completion,
- {ElementKind elementKind, bool isDeprecated}) {
+ {ElementKind? elementKind, bool? isDeprecated}) {
var expectedOffset = completion.indexOf(CURSOR_MARKER);
if (expectedOffset >= 0) {
if (completion.contains(CURSOR_MARKER, expectedOffset + 1)) {
@@ -31,8 +29,8 @@
} else {
expectedOffset = completion.length;
}
- CompletionSuggestion matchingSuggestion;
- suggestions.forEach((CompletionSuggestion suggestion) {
+ CompletionSuggestion? matchingSuggestion;
+ for (var suggestion in suggestions) {
if (suggestion.completion == completion) {
if (matchingSuggestion == null) {
matchingSuggestion = suggestion;
@@ -48,14 +46,14 @@
"Expected exactly one '$completion' but found multiple:\n $suggestedCompletions");
}
}
- });
+ }
if (matchingSuggestion == null) {
fail("Expected '$completion' but found none:\n $suggestedCompletions");
}
expect(matchingSuggestion.selectionOffset, equals(expectedOffset));
expect(matchingSuggestion.selectionLength, equals(0));
if (elementKind != null) {
- expect(matchingSuggestion.element.kind, elementKind);
+ expect(matchingSuggestion.element!.kind, elementKind);
}
if (isDeprecated != null) {
expect(matchingSuggestion.isDeprecated, isDeprecated);
@@ -74,14 +72,14 @@
/// "already typed".
void filterResults(String content) {
var charsAlreadyTyped =
- content.substring(replacementOffset, completionOffset).toLowerCase();
+ content.substring(replacementOffset!, completionOffset).toLowerCase();
suggestions = suggestions
.where((CompletionSuggestion suggestion) =>
suggestion.completion.toLowerCase().startsWith(charsAlreadyTyped))
.toList();
}
- Future runTest(LocationSpec spec, [Map<String, String> extraFiles]) {
+ Future runTest(LocationSpec spec, [Map<String, String>? extraFiles]) {
super.setUp();
return Future(() {
var content = spec.source;
@@ -113,7 +111,7 @@
int testLocation = -1;
List<String> positiveResults = <String>[];
List<String> negativeResults = <String>[];
- String source;
+ late String source;
LocationSpec(this.id);
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index b05effd..653339c 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'dart:async';
import 'package:analysis_server/protocol/protocol.dart';
@@ -20,7 +18,6 @@
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
-import 'package:meta/meta.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -263,7 +260,7 @@
Response testSetAnalysisRoots(List<String> included, List<String> excluded) {
var request =
AnalysisSetAnalysisRootsParams(included, excluded).toRequest('0');
- return handler.handleRequest(request);
+ return handler.handleRequest(request)!;
}
Future<void> xtest_getReachableSources_invalidSource() async {
@@ -276,10 +273,9 @@
var request = AnalysisGetReachableSourcesParams('/does/not/exist.dart')
.toRequest('0');
- var response = handler.handleRequest(request);
- expect(response.error, isNotNull);
- expect(response.error.code,
- RequestErrorCode.GET_REACHABLE_SOURCES_INVALID_FILE);
+ var response = handler.handleRequest(request)!;
+ var error = response.error!;
+ expect(error.code, RequestErrorCode.GET_REACHABLE_SOURCES_INVALID_FILE);
}
Future<void> xtest_getReachableSources_validSources() async {
@@ -293,9 +289,9 @@
await server.onAnalysisComplete;
var request = AnalysisGetReachableSourcesParams(fileA).toRequest('0');
- var response = handler.handleRequest(request);
+ var response = handler.handleRequest(request)!;
- Map json = response.toJson()[Response.RESULT];
+ var json = response.toJson()[Response.RESULT] as Map<String, dynamic>;
// Sanity checks.
expect(json['sources'], hasLength(6));
@@ -1418,9 +1414,9 @@
}
void _assertAnalyzedFiles({
- @required List<String> hasErrors,
+ required List<String> hasErrors,
List<String> noErrors = const [],
- @required List<String> notAnalyzed,
+ required List<String> notAnalyzed,
}) {
for (var path in hasErrors) {
assertHasErrors(path);
@@ -1454,9 +1450,9 @@
/// A helper to test 'analysis.*' requests.
class AnalysisTestHelper with ResourceProviderMixin {
- MockServerChannel serverChannel;
- AnalysisServer server;
- AnalysisDomainHandler handler;
+ late MockServerChannel serverChannel;
+ late AnalysisServer server;
+ late AnalysisDomainHandler handler;
Map<AnalysisService, List<String>> analysisSubscriptions = {};
@@ -1464,9 +1460,9 @@
Map<String, List<HighlightRegion>> filesHighlights = {};
Map<String, List<NavigationRegion>> filesNavigation = {};
- String projectPath;
- String testFile;
- String testCode;
+ late String projectPath;
+ late String testFile;
+ late String testCode;
AnalysisTestHelper() {
projectPath = convertPath('/project');
@@ -1773,8 +1769,7 @@
addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
// wait for analysis
await waitForTasksFinished();
- var params = pluginManager.analysisSetSubscriptionsParams;
- expect(params, isNotNull);
+ var params = pluginManager.analysisSetSubscriptionsParams!;
var subscriptions = params.subscriptions;
expect(subscriptions, hasLength(1));
var files = subscriptions[plugin.AnalysisService.HIGHLIGHTS];
diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart
index 8da9476..08d3056 100644
--- a/pkg/analysis_server/test/domain_completion_test.dart
+++ b/pkg/analysis_server/test/domain_completion_test.dart
@@ -2,11 +2,10 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/plugin/plugin_manager.dart';
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
+import 'package:analyzer/instrumentation/service.dart';
import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
@@ -15,6 +14,7 @@
import 'domain_completion_util.dart';
import 'mocks.dart';
+import 'src/plugin/plugin_manager_test.dart';
void main() {
defineReflectiveSuite(() {
@@ -735,7 +735,7 @@
.toRequest('0');
var response = await waitResponse(request);
expect(response.id, '0');
- expect(response.error.code, RequestErrorCode.INVALID_PARAMETER);
+ expect(response.error!.code, RequestErrorCode.INVALID_PARAMETER);
}
Future<void> test_overrides() {
@@ -803,7 +803,8 @@
^
}
''');
- PluginInfo info = DiscoveredPluginInfo('a', 'b', 'c', null, null);
+ PluginInfo info = DiscoveredPluginInfo('a', 'b', 'c',
+ TestNotificationManager(), InstrumentationService.NULL_SERVICE);
var result = plugin.CompletionGetSuggestionsResult(
testFile.indexOf('^'), 0, <CompletionSuggestion>[
CompletionSuggestion(CompletionSuggestionKind.IDENTIFIER,
diff --git a/pkg/analysis_server/test/domain_completion_util.dart b/pkg/analysis_server/test/domain_completion_util.dart
index 80786c5..8670a6f 100644
--- a/pkg/analysis_server/test/domain_completion_util.dart
+++ b/pkg/analysis_server/test/domain_completion_util.dart
@@ -17,7 +17,7 @@
class AbstractCompletionDomainTest extends AbstractAnalysisTest {
late String completionId;
late int completionOffset;
- late int replacementOffset;
+ int? replacementOffset;
late int replacementLength;
Map<String, Completer<void>> receivedSuggestionsCompleters = {};
List<CompletionSuggestion> suggestions = [];
diff --git a/pkg/analysis_server/test/edit/assists_test.dart b/pkg/analysis_server/test/edit/assists_test.dart
index 93a35f0..e2cb0dc 100644
--- a/pkg/analysis_server/test/edit/assists_test.dart
+++ b/pkg/analysis_server/test/edit/assists_test.dart
@@ -2,11 +2,10 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/edit/edit_domain.dart';
import 'package:analysis_server/src/plugin/plugin_manager.dart';
+import 'package:analyzer/instrumentation/service.dart';
import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
@@ -15,6 +14,7 @@
import '../analysis_abstract.dart';
import '../mocks.dart';
+import '../src/plugin/plugin_manager_test.dart';
void main() {
defineReflectiveSuite(() {
@@ -24,7 +24,7 @@
@reflectiveTest
class AssistsTest extends AbstractAnalysisTest {
- List<SourceChange> changes;
+ late List<SourceChange> changes;
Future<void> prepareAssists(String search, [int length = 0]) async {
var offset = findOffset(search);
@@ -46,7 +46,8 @@
}
Future<void> test_fromPlugins() async {
- PluginInfo info = DiscoveredPluginInfo('a', 'b', 'c', null, null);
+ PluginInfo info = DiscoveredPluginInfo('a', 'b', 'c',
+ TestNotificationManager(), InstrumentationService.NULL_SERVICE);
var message = 'From a plugin';
var change = plugin.PrioritizedSourceChange(
5,
diff --git a/pkg/analysis_server/test/edit/bulk_fixes_test.dart b/pkg/analysis_server/test/edit/bulk_fixes_test.dart
index 5d88990..d48358f 100644
--- a/pkg/analysis_server/test/edit/bulk_fixes_test.dart
+++ b/pkg/analysis_server/test/edit/bulk_fixes_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'dart:io';
import 'package:analysis_server/protocol/protocol_generated.dart';
@@ -11,7 +9,6 @@
import 'package:analysis_server/src/services/linter/lint_names.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:linter/src/rules.dart';
-import 'package:meta/meta.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -26,7 +23,7 @@
@reflectiveTest
class BulkFixesTest extends AbstractAnalysisTest {
void assertContains(List<BulkFix> details,
- {@required String path, @required String code, @required int count}) {
+ {required String path, required String code, required int count}) {
for (var detail in details) {
if (detail.path == path) {
for (var fix in detail.fixes) {
diff --git a/pkg/analysis_server/test/edit/format_test.dart b/pkg/analysis_server/test/edit/format_test.dart
index bcab9d1..1990b31 100644
--- a/pkg/analysis_server/test/edit/format_test.dart
+++ b/pkg/analysis_server/test/edit/format_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/edit/edit_domain.dart';
import 'package:test/test.dart';
@@ -112,7 +110,7 @@
}
EditFormatResult _formatAt(int selectionOffset, int selectionLength,
- {int lineLength}) {
+ {int? lineLength}) {
var request = EditFormatParams(testFile, selectionOffset, selectionLength,
lineLength: lineLength)
.toRequest('0');
diff --git a/pkg/analysis_server/test/edit/organize_directives_test.dart b/pkg/analysis_server/test/edit/organize_directives_test.dart
index e81ca0e..c18850e 100644
--- a/pkg/analysis_server/test/edit/organize_directives_test.dart
+++ b/pkg/analysis_server/test/edit/organize_directives_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/edit/edit_domain.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
@@ -21,7 +19,7 @@
@reflectiveTest
class OrganizeDirectivesTest extends AbstractAnalysisTest {
- SourceFileEdit fileEdit;
+ late SourceFileEdit fileEdit;
@override
void setUp() {
diff --git a/pkg/analysis_server/test/edit/refactoring_test.dart b/pkg/analysis_server/test/edit/refactoring_test.dart
index 9baa5b3..d14a01d 100644
--- a/pkg/analysis_server/test/edit/refactoring_test.dart
+++ b/pkg/analysis_server/test/edit/refactoring_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/edit/edit_domain.dart';
@@ -248,7 +246,7 @@
@reflectiveTest
class ExtractLocalVariableTest extends _AbstractGetRefactoring_Test {
Future<Response> sendExtractRequest(
- int offset, int length, String name, bool extractAll) {
+ int offset, int length, String? name, bool extractAll) {
var kind = RefactoringKind.EXTRACT_LOCAL_VARIABLE;
var options =
name != null ? ExtractLocalVariableOptions(name, extractAll) : null;
@@ -263,7 +261,7 @@
}
Future<Response> sendStringSuffixRequest(
- String search, String suffix, String name, bool extractAll) {
+ String search, String suffix, String? name, bool extractAll) {
var offset = findOffset(search + suffix);
var length = search.length;
return sendExtractRequest(offset, length, name, extractAll);
@@ -293,7 +291,7 @@
return sendStringRequest('1 + 2', 'res', true);
});
// We get the refactoring feedback....
- ExtractLocalVariableFeedback feedback = result.feedback;
+ var feedback = result.feedback as ExtractLocalVariableFeedback;
expect(feedback.names, contains('myName'));
}
@@ -306,7 +304,7 @@
return getRefactoringResult(() {
return sendExtractRequest(testCode.indexOf('222 +'), 0, 'res', true);
}).then((result) {
- ExtractLocalVariableFeedback feedback = result.feedback;
+ var feedback = result.feedback as ExtractLocalVariableFeedback;
expect(feedback.coveringExpressionOffsets, [
testCode.indexOf('222 +'),
testCode.indexOf('111 +'),
@@ -390,7 +388,7 @@
var result = await getRefactoringResult(() {
return sendStringSuffixRequest('getSelectedItem()', ';', null, true);
});
- ExtractLocalVariableFeedback feedback = result.feedback;
+ var feedback = result.feedback as ExtractLocalVariableFeedback;
expect(
feedback.names, unorderedEquals(['treeItem', 'item', 'selectedItem']));
expect(result.change, isNull);
@@ -426,7 +424,7 @@
return getRefactoringResult(() {
return sendStringRequest('1 + 2', 'res', true);
}).then((result) {
- ExtractLocalVariableFeedback feedback = result.feedback;
+ var feedback = result.feedback as ExtractLocalVariableFeedback;
expect(feedback.offsets, [findOffset('1 + 2'), findOffset('1 + 2')]);
expect(feedback.lengths, [5, 6]);
});
@@ -490,7 +488,7 @@
var result = await getRefactoringResult(() {
return sendStringRequest('1 + 2', 'res', true);
});
- ExtractLocalVariableFeedback feedback = result.feedback;
+ var feedback = result.feedback as ExtractLocalVariableFeedback;
expect(feedback.names, contains('myName'));
}
var initialResetCount = test_resetCount;
@@ -515,7 +513,7 @@
var result = await getRefactoringResult(() {
return sendStringRequest('1 + 2', 'res', true);
});
- ExtractLocalVariableFeedback feedback = result.feedback;
+ var feedback = result.feedback as ExtractLocalVariableFeedback;
expect(feedback.names, contains('myName'));
}
var initialResetCount = test_resetCount;
@@ -534,7 +532,7 @@
var result = await getRefactoringResult(() {
return sendStringRequest('1 + 2', 'res', true);
});
- ExtractLocalVariableFeedback feedback = result.feedback;
+ var feedback = result.feedback as ExtractLocalVariableFeedback;
// The refactoring was reset, so we don't get stale results.
expect(feedback.names, contains('otherName'));
}
@@ -549,8 +547,8 @@
''');
return waitForTasksFinished().then((_) {
return sendStringRequest('1 + 2', 'res', true).then((response) {
- expect(response.error, isNotNull);
- expect(response.error.code, RequestErrorCode.SERVER_ERROR);
+ var error = response.error!;
+ expect(error.code, RequestErrorCode.SERVER_ERROR);
});
});
}
@@ -564,8 +562,8 @@
''');
return waitForTasksFinished().then((_) {
return sendStringRequest('1 + 2', 'res', true).then((response) {
- expect(response.error, isNotNull);
- expect(response.error.code, RequestErrorCode.SERVER_ERROR);
+ var error = response.error!;
+ expect(error.code, RequestErrorCode.SERVER_ERROR);
});
});
}
@@ -579,8 +577,8 @@
''');
return waitForTasksFinished().then((_) {
return sendStringRequest('1 + 2', 'res', true).then((response) {
- expect(response.error, isNotNull);
- expect(response.error.code, RequestErrorCode.SERVER_ERROR);
+ var error = response.error!;
+ expect(error.code, RequestErrorCode.SERVER_ERROR);
});
});
}
@@ -588,10 +586,10 @@
@reflectiveTest
class ExtractMethodTest extends _AbstractGetRefactoring_Test {
- int offset;
- int length;
+ late int offset;
+ late int length;
String name = 'res';
- ExtractMethodOptions options;
+ ExtractMethodOptions? options;
Future<void> test_expression() {
addTestFile('''
@@ -644,13 +642,13 @@
''');
_setOffsetLengthForString('a + b');
var result = await getRefactoringResult(_computeChange);
- ExtractMethodFeedback feedback = result.feedback;
+ var feedback = result.feedback as ExtractMethodFeedback;
var parameters = feedback.parameters;
parameters[0].name = 'aaa';
parameters[1].name = 'bbb';
parameters[1].type = 'num';
parameters.insert(0, parameters.removeLast());
- options.parameters = parameters;
+ options!.parameters = parameters;
return assertSuccessfulRefactoring(_sendExtractRequest, '''
main() {
int a = 1;
@@ -775,7 +773,7 @@
await waitForTasksFinished();
var response = await _sendExtractRequest();
var result = EditGetRefactoringResult.fromResponse(response);
- return result.feedback;
+ return result.feedback as ExtractMethodFeedback;
}
Future _prepareOptions() {
@@ -785,7 +783,7 @@
}).then((result) {
assertResultProblemsOK(result);
// fill options from result
- ExtractMethodFeedback feedback = result.feedback;
+ var feedback = result.feedback as ExtractMethodFeedback;
options = ExtractMethodOptions(
feedback.returnType, false, name, feedback.parameters, true);
// done
@@ -811,7 +809,7 @@
@reflectiveTest
class GetAvailableRefactoringsTest extends AbstractAnalysisTest {
- List<RefactoringKind> kinds;
+ late List<RefactoringKind> kinds;
void addFlutterPackage() {
var libFolder = MockPackages.instance.addFlutter(resourceProvider);
@@ -1077,7 +1075,7 @@
return _sendInlineRequest('res =');
});
// We get the refactoring feedback....
- InlineLocalVariableFeedback feedback = result.feedback;
+ var feedback = result.feedback as InlineLocalVariableFeedback;
expect(feedback.occurrences, 2);
}
@@ -1092,7 +1090,7 @@
return getRefactoringResult(() {
return _sendInlineRequest('test =');
}).then((result) {
- InlineLocalVariableFeedback feedback = result.feedback;
+ var feedback = result.feedback as InlineLocalVariableFeedback;
expect(feedback.name, 'test');
expect(feedback.occurrences, 2);
});
@@ -1183,7 +1181,7 @@
return getRefactoringResult(() {
return _sendInlineRequest('test(int p)');
}).then((result) {
- InlineMethodFeedback feedback = result.feedback;
+ var feedback = result.feedback as InlineMethodFeedback;
expect(feedback.className, 'A');
expect(feedback.methodName, 'test');
expect(feedback.isDeclaration, isTrue);
@@ -1288,7 +1286,7 @@
@reflectiveTest
class MoveFileTest extends _AbstractGetRefactoring_Test {
- MoveFileOptions options;
+ late MoveFileOptions options;
@failingTest
Future<void> test_OK() {
@@ -1322,7 +1320,7 @@
@reflectiveTest
class RenameTest extends _AbstractGetRefactoring_Test {
- Future<Response> sendRenameRequest(String search, String newName,
+ Future<Response> sendRenameRequest(String search, String? newName,
{String id = '0', bool validateOnly = false}) {
var options = newName != null ? RenameOptions(newName) : null;
var request = EditGetRefactoringParams(RefactoringKind.RENAME, testFile,
@@ -1409,7 +1407,7 @@
}
''',
feedbackValidator: (feedback) {
- RenameFeedback renameFeedback = feedback;
+ var renameFeedback = feedback as RenameFeedback;
expect(renameFeedback.offset, 18);
expect(renameFeedback.length, 4);
},
@@ -1438,7 +1436,7 @@
}
''',
feedbackValidator: (feedback) {
- RenameFeedback renameFeedback = feedback;
+ var renameFeedback = feedback as RenameFeedback;
expect(renameFeedback.offset, 42);
expect(renameFeedback.length, 4);
},
@@ -1467,7 +1465,7 @@
}
''',
feedbackValidator: (feedback) {
- RenameFeedback renameFeedback = feedback;
+ var renameFeedback = feedback as RenameFeedback;
expect(renameFeedback.offset, 48);
expect(renameFeedback.length, 4);
},
@@ -1496,7 +1494,7 @@
}
''',
feedbackValidator: (feedback) {
- RenameFeedback renameFeedback = feedback;
+ var renameFeedback = feedback as RenameFeedback;
expect(renameFeedback.offset, 42);
expect(renameFeedback.length, 4);
},
@@ -1525,7 +1523,7 @@
}
''',
feedbackValidator: (feedback) {
- RenameFeedback renameFeedback = feedback;
+ var renameFeedback = feedback as RenameFeedback;
expect(renameFeedback.offset, 48);
expect(renameFeedback.length, 4);
},
@@ -1559,7 +1557,7 @@
return getRefactoringResult(() {
return sendRenameRequest('Test {}', 'NewName', validateOnly: true);
}).then((result) {
- RenameFeedback feedback = result.feedback;
+ var feedback = result.feedback as RenameFeedback;
assertResultProblemsOK(result);
expect(feedback.elementKindName, 'class');
expect(feedback.oldName, 'Test');
@@ -1735,13 +1733,12 @@
}).then((result) {
assertResultProblemsOK(result);
// prepare potential edit ID
- var potentialIds = result.potentialEdits;
+ var potentialIds = result.potentialEdits!;
expect(potentialIds, hasLength(1));
var potentialId = potentialIds[0];
// find potential edit
- var change = result.change;
- var potentialEdit = _findEditWithId(change, potentialId);
- expect(potentialEdit, isNotNull);
+ var change = result.change!;
+ var potentialEdit = _findEditWithId(change, potentialId)!;
expect(potentialEdit.offset, findOffset('test(); // a2'));
expect(potentialEdit.length, 4);
});
@@ -1790,7 +1787,7 @@
}
''',
feedbackValidator: (feedback) {
- RenameFeedback renameFeedback = feedback;
+ var renameFeedback = feedback as RenameFeedback;
expect(renameFeedback.offset, 20);
expect(renameFeedback.length, 4);
},
@@ -1819,7 +1816,7 @@
}
''',
feedbackValidator: (feedback) {
- RenameFeedback renameFeedback = feedback;
+ var renameFeedback = feedback as RenameFeedback;
expect(renameFeedback.offset, 43);
expect(renameFeedback.length, 4);
},
@@ -1836,7 +1833,7 @@
return getRefactoringResult(() {
return sendRenameRequest('st v;', 'NewName');
}).then((result) {
- RenameFeedback feedback = result.feedback;
+ var feedback = result.feedback as RenameFeedback;
expect(feedback, isNotNull);
expect(feedback.offset, findOffset('Test v;'));
expect(feedback.length, 'Test'.length);
@@ -1930,7 +1927,7 @@
}
''',
feedbackValidator: (feedback) {
- RenameFeedback renameFeedback = feedback;
+ var renameFeedback = feedback as RenameFeedback;
expect(renameFeedback.offset, -1);
expect(renameFeedback.length, 0);
});
@@ -1958,7 +1955,7 @@
}
''',
feedbackValidator: (feedback) {
- RenameFeedback renameFeedback = feedback;
+ var renameFeedback = feedback as RenameFeedback;
expect(renameFeedback.offset, 51);
expect(renameFeedback.length, 4);
});
@@ -2127,7 +2124,7 @@
print(otherName);
}
''');
- server.getAnalysisDriver(testFile).getResult2(testFile);
+ server.getAnalysisDriver(testFile)!.getResult2(testFile);
// send the second request, with the same kind, file and offset
await waitForTasksFinished();
result = await getRefactoringResult(() {
@@ -2143,8 +2140,8 @@
isResponseFailure('0', RequestErrorCode.REFACTORING_REQUEST_CANCELLED));
}
- SourceEdit _findEditWithId(SourceChange change, String id) {
- SourceEdit potentialEdit;
+ SourceEdit? _findEditWithId(SourceChange change, String id) {
+ SourceEdit? potentialEdit;
change.edits.forEach((fileEdit) {
fileEdit.edits.forEach((edit) {
if (edit.id == id) {
@@ -2155,9 +2152,8 @@
return potentialEdit;
}
- void _validateFeedback(EditGetRefactoringResult result, {String oldName}) {
- RenameFeedback feedback = result.feedback;
- expect(feedback, isNotNull);
+ void _validateFeedback(EditGetRefactoringResult result, {String? oldName}) {
+ var feedback = result.feedback as RenameFeedback;
if (oldName != null) {
expect(feedback.oldName, oldName);
}
@@ -2170,7 +2166,7 @@
/// Asserts that [problems] has a single ERROR problem.
void assertResultProblemsError(List<RefactoringProblem> problems,
- [String message]) {
+ [String? message]) {
var problem = problems[0];
expect(problem.severity, RefactoringProblemSeverity.ERROR,
reason: problem.toString());
@@ -2181,7 +2177,7 @@
/// Asserts that [result] has a single FATAL problem.
void assertResultProblemsFatal(List<RefactoringProblem> problems,
- [String message]) {
+ [String? message]) {
var problem = problems[0];
expect(problems, hasLength(1));
expect(problem.severity, RefactoringProblemSeverity.FATAL,
@@ -2200,7 +2196,7 @@
/// Asserts that [result] has a single WARNING problem.
void assertResultProblemsWarning(List<RefactoringProblem> problems,
- [String message]) {
+ [String? message]) {
var problem = problems[0];
expect(problems, hasLength(1));
expect(problem.severity, RefactoringProblemSeverity.WARNING,
@@ -2212,7 +2208,7 @@
Future assertSuccessfulRefactoring(
Future<Response> Function() requestSender, String expectedCode,
- {void Function(RefactoringFeedback) feedbackValidator}) async {
+ {void Function(RefactoringFeedback?)? feedbackValidator}) async {
var result = await getRefactoringResult(requestSender);
assertResultProblemsOK(result);
if (feedbackValidator != null) {
@@ -2225,8 +2221,7 @@
/// which results in the [expectedCode].
void assertTestRefactoringResult(
EditGetRefactoringResult result, String expectedCode) {
- var change = result.change;
- expect(change, isNotNull);
+ var change = result.change!;
for (var fileEdit in change.edits) {
if (fileEdit.file == testFile) {
var actualCode = SourceEdit.applySequence(testCode, fileEdit.edits);
@@ -2247,7 +2242,7 @@
}
Future<Response> sendRequest(
- RefactoringKind kind, int offset, int length, RefactoringOptions options,
+ RefactoringKind kind, int offset, int length, RefactoringOptions? options,
[bool validateOnly = false]) {
var request = EditGetRefactoringParams(
kind, testFile, offset, length, validateOnly,
diff --git a/pkg/analysis_server/test/edit/sort_members_test.dart b/pkg/analysis_server/test/edit/sort_members_test.dart
index 083b834..52c1932 100644
--- a/pkg/analysis_server/test/edit/sort_members_test.dart
+++ b/pkg/analysis_server/test/edit/sort_members_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/edit/edit_domain.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
@@ -21,7 +19,7 @@
@reflectiveTest
class SortMembersTest extends AbstractAnalysisTest {
- SourceFileEdit fileEdit;
+ late SourceFileEdit fileEdit;
@override
void setUp() {
diff --git a/pkg/analysis_server/test/edit/statement_completion_test.dart b/pkg/analysis_server/test/edit/statement_completion_test.dart
index c442c9c..09e11a7 100644
--- a/pkg/analysis_server/test/edit/statement_completion_test.dart
+++ b/pkg/analysis_server/test/edit/statement_completion_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/edit/edit_domain.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
@@ -21,7 +19,7 @@
@reflectiveTest
class StatementCompletionTest extends AbstractAnalysisTest {
- SourceChange change;
+ late SourceChange change;
@override
void setUp() {
@@ -103,7 +101,7 @@
(s) => s.indexOf(match) + match.length); // Ensure cursor after '='.
}
- void _assertHasChange(String message, String expectedCode, [Function cmp]) {
+ void _assertHasChange(String message, String expectedCode, [Function? cmp]) {
if (change.message == message) {
if (change.edits.isNotEmpty) {
var resultCode =
@@ -111,12 +109,12 @@
expect(resultCode, expectedCode.replaceAll('/*caret*/', ''));
if (cmp != null) {
int offset = cmp(resultCode);
- expect(change.selection.offset, offset);
+ expect(change.selection!.offset, offset);
}
} else {
if (cmp != null) {
int offset = cmp(testCode);
- expect(change.selection.offset, offset);
+ expect(change.selection!.offset, offset);
}
}
return;
diff --git a/pkg/analysis_server/test/edit/test_all.dart b/pkg/analysis_server/test/edit/test_all.dart
index e1d5aec..21cf0bc 100644
--- a/pkg/analysis_server/test/edit/test_all.dart
+++ b/pkg/analysis_server/test/edit/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'assists_test.dart' as assists;
diff --git a/pkg/analysis_server/test/search/abstract_search_domain.dart b/pkg/analysis_server/test/search/abstract_search_domain.dart
index f6e20ee..cba622f 100644
--- a/pkg/analysis_server/test/search/abstract_search_domain.dart
+++ b/pkg/analysis_server/test/search/abstract_search_domain.dart
@@ -13,7 +13,7 @@
class AbstractSearchDomainTest extends AbstractAnalysisTest {
final Map<String, _ResultSet> resultSets = {};
- late String searchId;
+ String? searchId;
List<SearchResult> results = <SearchResult>[];
late SearchResult result;
diff --git a/pkg/analysis_server/test/search/declarations_test.dart b/pkg/analysis_server/test/search/declarations_test.dart
index 349085d..a1f4900 100644
--- a/pkg/analysis_server/test/search/declarations_test.dart
+++ b/pkg/analysis_server/test/search/declarations_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
@@ -19,10 +17,10 @@
@reflectiveTest
class DeclarationsTest extends AbstractSearchDomainTest {
- SearchGetElementDeclarationsResult declarationsResult;
+ late SearchGetElementDeclarationsResult declarationsResult;
ElementDeclaration assertHas(String name, ElementKind kind,
- {String className, String mixinName}) {
+ {String? className, String? mixinName}) {
return declarationsResult.declarations.singleWhere((ElementDeclaration d) =>
declarationsResult.files[d.fileIndex] == testFile &&
d.name == name &&
@@ -214,7 +212,7 @@
}
Future<void> _getDeclarations(
- {String file, String pattern, int maxResults}) async {
+ {String? file, String? pattern, int? maxResults}) async {
var request = SearchGetElementDeclarationsParams(
file: file, pattern: pattern, maxResults: maxResults)
.toRequest('0');
diff --git a/pkg/analysis_server/test/search/element_references_test.dart b/pkg/analysis_server/test/search/element_references_test.dart
index 1049186..9515144 100644
--- a/pkg/analysis_server/test/search/element_references_test.dart
+++ b/pkg/analysis_server/test/search/element_references_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
@@ -19,7 +17,7 @@
@reflectiveTest
class ElementReferencesTest extends AbstractSearchDomainTest {
- Element searchElement;
+ Element? searchElement;
void assertHasRef(SearchResultKind kind, String search, bool isPotential) {
assertHasResult(kind, search);
@@ -53,7 +51,7 @@
}
''');
await findElementReferences('named(p)', false);
- expect(searchElement.kind, ElementKind.CONSTRUCTOR);
+ expect(searchElement!.kind, ElementKind.CONSTRUCTOR);
expect(results, hasLength(2));
assertHasResult(SearchResultKind.REFERENCE, '.named(1)', 6);
assertHasResult(SearchResultKind.REFERENCE, '.named(2)', 6);
@@ -77,7 +75,7 @@
}
''');
await findElementReferences('named(p); // A', true);
- expect(searchElement.kind, ElementKind.CONSTRUCTOR);
+ expect(searchElement!.kind, ElementKind.CONSTRUCTOR);
expect(results, hasLength(1));
assertHasResult(SearchResultKind.REFERENCE, '.named(1)', 6);
}
@@ -93,7 +91,7 @@
}
''');
await findElementReferences('A(p)', false);
- expect(searchElement.kind, ElementKind.CONSTRUCTOR);
+ expect(searchElement!.kind, ElementKind.CONSTRUCTOR);
expect(results, hasLength(2));
assertHasResult(SearchResultKind.REFERENCE, '(1)', 0);
assertHasResult(SearchResultKind.REFERENCE, '(2)', 0);
@@ -122,7 +120,7 @@
}
''');
await findElementReferences('A(p)', true);
- expect(searchElement.kind, ElementKind.CONSTRUCTOR);
+ expect(searchElement!.kind, ElementKind.CONSTRUCTOR);
expect(results, hasLength(1));
assertHasResult(SearchResultKind.REFERENCE, '(1)', 0);
}
@@ -140,7 +138,7 @@
}
''');
await findElementReferences('E on int', false);
- expect(searchElement.kind, ElementKind.EXTENSION);
+ expect(searchElement!.kind, ElementKind.EXTENSION);
expect(results, hasLength(2));
assertHasResult(SearchResultKind.REFERENCE, 'E.foo();');
assertHasResult(SearchResultKind.REFERENCE, 'E(0)');
@@ -167,7 +165,7 @@
}
''');
await findElementReferences('fff; // declaration', false);
- expect(searchElement.kind, ElementKind.FIELD);
+ expect(searchElement!.kind, ElementKind.FIELD);
expect(results, hasLength(10));
assertHasResult(SearchResultKind.WRITE, 'fff); // in constructor');
assertHasResult(SearchResultKind.WRITE, 'fff = 1;');
@@ -200,7 +198,7 @@
''');
{
await findElementReferences('fff =>', false);
- expect(searchElement.kind, ElementKind.FIELD);
+ expect(searchElement!.kind, ElementKind.FIELD);
expect(results, hasLength(4));
assertHasResult(SearchResultKind.READ, 'fff); // in m()');
assertHasResult(SearchResultKind.WRITE, 'fff = 1;');
@@ -229,7 +227,7 @@
}
''');
await findElementReferences('fff); // in constructor', false);
- expect(searchElement.kind, ElementKind.FIELD);
+ expect(searchElement!.kind, ElementKind.FIELD);
expect(results, hasLength(3));
assertHasResult(SearchResultKind.WRITE, 'fff); // in constructor');
assertHasResult(SearchResultKind.WRITE, 'fff = 2;');
@@ -257,7 +255,7 @@
}
''');
await findElementReferences('fff; // declaration', false);
- expect(searchElement.kind, ElementKind.FIELD);
+ expect(searchElement!.kind, ElementKind.FIELD);
expect(results, hasLength(8));
// m()
assertHasResult(SearchResultKind.WRITE, 'fff = 2;');
@@ -288,7 +286,7 @@
''');
{
await findElementReferences('fff =>', false);
- expect(searchElement.kind, ElementKind.FIELD);
+ expect(searchElement!.kind, ElementKind.FIELD);
expect(results, hasLength(4));
assertHasResult(SearchResultKind.READ, 'fff); // in m()');
assertHasResult(SearchResultKind.WRITE, 'fff = 1;');
@@ -322,7 +320,7 @@
''');
{
await findElementReferences('fff =>', false);
- expect(searchElement.kind, ElementKind.FIELD);
+ expect(searchElement!.kind, ElementKind.FIELD);
expect(results, hasLength(4));
assertHasResult(SearchResultKind.READ, 'fff); // in m()');
assertHasResult(SearchResultKind.WRITE, 'fff = 1;');
@@ -348,7 +346,7 @@
}
''');
await findElementReferences('fff(p) {}', false);
- expect(searchElement.kind, ElementKind.FUNCTION);
+ expect(searchElement!.kind, ElementKind.FUNCTION);
expect(results, hasLength(2));
assertHasResult(SearchResultKind.INVOCATION, 'fff(1)');
assertHasResult(SearchResultKind.REFERENCE, 'fff);');
@@ -372,7 +370,7 @@
}
''');
await findElementReferences('fff; // in B', false);
- expect(searchElement.kind, ElementKind.FIELD);
+ expect(searchElement!.kind, ElementKind.FIELD);
assertHasResult(SearchResultKind.WRITE, 'fff = 10;');
assertHasResult(SearchResultKind.WRITE, 'fff = 20;');
assertHasResult(SearchResultKind.WRITE, 'fff = 30;');
@@ -396,7 +394,7 @@
}
''');
await findElementReferences('mmm(_) {} // in B', false);
- expect(searchElement.kind, ElementKind.METHOD);
+ expect(searchElement!.kind, ElementKind.METHOD);
assertHasResult(SearchResultKind.INVOCATION, 'mmm(10)');
assertHasResult(SearchResultKind.INVOCATION, 'mmm(20)');
assertHasResult(SearchResultKind.INVOCATION, 'mmm(30)');
@@ -420,7 +418,7 @@
}
''');
await findElementReferences('mmm(_) {} // in B', false);
- expect(searchElement.kind, ElementKind.METHOD);
+ expect(searchElement!.kind, ElementKind.METHOD);
expect(results, hasLength(1));
assertHasResult(SearchResultKind.INVOCATION, 'mmm(20)');
}
@@ -443,7 +441,7 @@
}
''');
await findElementReferences('p}) {} // in B', false);
- expect(searchElement.kind, ElementKind.PARAMETER);
+ expect(searchElement!.kind, ElementKind.PARAMETER);
assertHasResult(SearchResultKind.REFERENCE, 'p: 1');
assertHasResult(SearchResultKind.REFERENCE, 'p: 2');
assertHasResult(SearchResultKind.REFERENCE, 'p: 3');
@@ -462,7 +460,7 @@
}
''');
await findElementReferences('myLabel; // break', false);
- expect(searchElement.kind, ElementKind.LABEL);
+ expect(searchElement!.kind, ElementKind.LABEL);
expect(results, hasLength(2));
assertHasResult(SearchResultKind.REFERENCE, 'myLabel; // continue');
assertHasResult(SearchResultKind.REFERENCE, 'myLabel; // break');
@@ -479,7 +477,7 @@
}
''');
await findElementReferences('vvv = 1', false);
- expect(searchElement.kind, ElementKind.LOCAL_VARIABLE);
+ expect(searchElement!.kind, ElementKind.LOCAL_VARIABLE);
expect(results, hasLength(4));
assertHasResult(SearchResultKind.READ, 'vvv);');
assertHasResult(SearchResultKind.READ_WRITE, 'vvv += 3');
@@ -502,7 +500,7 @@
}
''');
await findElementReferences('mmm(p) {}', false);
- expect(searchElement.kind, ElementKind.METHOD);
+ expect(searchElement!.kind, ElementKind.METHOD);
expect(results, hasLength(4));
assertHasResult(SearchResultKind.INVOCATION, 'mmm(1);');
assertHasResult(SearchResultKind.REFERENCE, 'mmm); // in m()');
@@ -524,7 +522,7 @@
}
''');
await findElementReferences('foo() {}', false);
- expect(searchElement.kind, ElementKind.METHOD);
+ expect(searchElement!.kind, ElementKind.METHOD);
expect(results, hasLength(4));
assertHasResult(SearchResultKind.INVOCATION, 'foo(); // 1');
assertHasResult(SearchResultKind.REFERENCE, 'foo; // 2');
@@ -544,7 +542,7 @@
}
''');
await findElementReferences('mmm(p) {}', false);
- expect(searchElement.kind, ElementKind.METHOD);
+ expect(searchElement!.kind, ElementKind.METHOD);
expect(results, hasLength(2));
assertHasResult(SearchResultKind.INVOCATION, 'mmm(10);');
assertHasResult(SearchResultKind.REFERENCE, 'mmm);');
@@ -556,7 +554,7 @@
class B extends Object with A {} // B
''');
await findElementReferences('A {}', false);
- expect(searchElement.kind, ElementKind.MIXIN);
+ expect(searchElement!.kind, ElementKind.MIXIN);
expect(results, hasLength(1));
assertHasResult(SearchResultKind.REFERENCE, 'A {} // B');
}
@@ -594,7 +592,7 @@
}
''');
await findElementReferences('ppp) {', false);
- expect(searchElement.kind, ElementKind.PARAMETER);
+ expect(searchElement!.kind, ElementKind.PARAMETER);
expect(results, hasLength(4));
assertHasResult(SearchResultKind.READ, 'ppp);');
assertHasResult(SearchResultKind.READ_WRITE, 'ppp += 3');
@@ -801,9 +799,10 @@
}
''');
await findElementReferences('ppp;', false);
+ var searchElement = this.searchElement!;
expect(searchElement.kind, ElementKind.PREFIX);
expect(searchElement.name, 'ppp');
- expect(searchElement.location.startLine, 1);
+ expect(searchElement.location!.startLine, 1);
expect(results, hasLength(2));
assertHasResult(SearchResultKind.REFERENCE, 'ppp.Future');
assertHasResult(SearchResultKind.REFERENCE, 'ppp.Stream');
@@ -820,7 +819,7 @@
}
''');
await findElementReferences('vvv = 1', false);
- expect(searchElement.kind, ElementKind.TOP_LEVEL_VARIABLE);
+ expect(searchElement!.kind, ElementKind.TOP_LEVEL_VARIABLE);
expect(results, hasLength(4));
assertHasResult(SearchResultKind.READ, 'vvv);');
assertHasResult(SearchResultKind.WRITE, 'vvv += 3');
@@ -839,7 +838,7 @@
''');
{
await findElementReferences('vvv =>', false);
- expect(searchElement.kind, ElementKind.TOP_LEVEL_VARIABLE);
+ expect(searchElement!.kind, ElementKind.TOP_LEVEL_VARIABLE);
expect(results, hasLength(2));
assertHasResult(SearchResultKind.READ, 'vvv);');
assertHasResult(SearchResultKind.WRITE, 'vvv = 1;');
@@ -860,7 +859,7 @@
}
''');
await findElementReferences('int a', false);
- expect(searchElement.kind, ElementKind.CLASS);
+ expect(searchElement!.kind, ElementKind.CLASS);
assertHasResult(SearchResultKind.REFERENCE, 'int a');
assertHasResult(SearchResultKind.REFERENCE, 'int b');
}
@@ -872,7 +871,7 @@
}
''');
await findElementReferences('F =', false);
- expect(searchElement.kind, ElementKind.TYPE_ALIAS);
+ expect(searchElement!.kind, ElementKind.TYPE_ALIAS);
expect(results, hasLength(1));
assertHasResult(SearchResultKind.REFERENCE, 'F f');
}
@@ -885,13 +884,13 @@
''');
// Can find `A`.
await findElementReferences('A<T> =', false);
- expect(searchElement.kind, ElementKind.TYPE_ALIAS);
+ expect(searchElement!.kind, ElementKind.TYPE_ALIAS);
expect(results, hasLength(1));
assertHasResult(SearchResultKind.REFERENCE, 'A<String>');
// Can find in `A`.
await findElementReferences('int,', false);
- expect(searchElement.kind, ElementKind.CLASS);
+ expect(searchElement!.kind, ElementKind.CLASS);
assertHasResult(SearchResultKind.REFERENCE, 'int,');
}
@@ -902,7 +901,7 @@
}
''');
await findElementReferences('F()', false);
- expect(searchElement.kind, ElementKind.TYPE_ALIAS);
+ expect(searchElement!.kind, ElementKind.TYPE_ALIAS);
expect(results, hasLength(1));
assertHasResult(SearchResultKind.REFERENCE, 'F f');
}
@@ -915,7 +914,7 @@
}
''');
await findElementReferences('T> {', false);
- expect(searchElement.kind, ElementKind.TYPE_PARAMETER);
+ expect(searchElement!.kind, ElementKind.TYPE_PARAMETER);
expect(results, hasLength(2));
assertHasResult(SearchResultKind.REFERENCE, 'T f;');
assertHasResult(SearchResultKind.REFERENCE, 'T m()');
diff --git a/pkg/analysis_server/test/search/member_declarations_test.dart b/pkg/analysis_server/test/search/member_declarations_test.dart
index 46e9a46..d838f8e 100644
--- a/pkg/analysis_server/test/search/member_declarations_test.dart
+++ b/pkg/analysis_server/test/search/member_declarations_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
@@ -20,10 +18,11 @@
@reflectiveTest
class MemberDeclarationsTest extends AbstractSearchDomainTest {
void assertHasDeclaration(ElementKind kind, String className) {
- result = findTopLevelResult(kind, className);
+ var result = findTopLevelResult(kind, className);
if (result == null) {
fail('Not found: kind=$kind in="$className"\nin\n' + results.join('\n'));
}
+ this.result = result;
}
Future findMemberDeclarations(String name) async {
@@ -35,7 +34,7 @@
return waitForSearchResults();
}
- SearchResult findTopLevelResult(ElementKind kind, String enclosingClass) {
+ SearchResult? findTopLevelResult(ElementKind kind, String enclosingClass) {
for (var result in results) {
var element = result.path[0];
var clazz = result.path[1];
diff --git a/pkg/analysis_server/test/search/member_references_test.dart b/pkg/analysis_server/test/search/member_references_test.dart
index ca74c67..a2c7b18 100644
--- a/pkg/analysis_server/test/search/member_references_test.dart
+++ b/pkg/analysis_server/test/search/member_references_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/search/test_all.dart b/pkg/analysis_server/test/search/test_all.dart
index b4e4f8c..403be90 100644
--- a/pkg/analysis_server/test/search/test_all.dart
+++ b/pkg/analysis_server/test/search/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'declarations_test.dart' as declarations_test;
diff --git a/pkg/analysis_server/test/search/top_level_declarations_test.dart b/pkg/analysis_server/test/search/top_level_declarations_test.dart
index 37a7cf8..2242204 100644
--- a/pkg/analysis_server/test/search/top_level_declarations_test.dart
+++ b/pkg/analysis_server/test/search/top_level_declarations_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
@@ -20,14 +18,15 @@
@reflectiveTest
class TopLevelDeclarationsTest extends AbstractSearchDomainTest {
void assertHasDeclaration(ElementKind kind, String name) {
- result = findTopLevelResult(kind, name);
+ var result = findTopLevelResult(kind, name);
if (result == null) {
fail('Not found: kind=$kind name="$name"\nin\n' + results.join('\n'));
}
+ this.result = result;
}
void assertNoDeclaration(ElementKind kind, String name) {
- result = findTopLevelResult(kind, name);
+ var result = findTopLevelResult(kind, name);
if (result != null) {
fail('Unexpected: kind=$kind name="$name"\nin\n' + results.join('\n'));
}
@@ -44,7 +43,7 @@
return waitForSearchResults();
}
- SearchResult findTopLevelResult(ElementKind kind, String name) {
+ SearchResult? findTopLevelResult(ElementKind kind, String name) {
for (var result in results) {
var element = result.path[0];
if (element.kind == kind && element.name == name) {
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 701f7c5..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
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart b/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart
index 8a2fcd3b..81532df 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/deprecated_member_test.dart b/pkg/analysis_server/test/services/completion/dart/relevance/deprecated_member_test.dart
index fe82af1..44d0f92 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/deprecated_member_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/deprecated_member_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_test.dart b/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_test.dart
index 5faa5df..de08d73 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'completion_relevance.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/is_no_such_method_test.dart b/pkg/analysis_server/test/services/completion/dart/relevance/is_no_such_method_test.dart
index 52327e6..388a377 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/is_no_such_method_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/is_no_such_method_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/local_variable_test.dart b/pkg/analysis_server/test/services/completion/dart/relevance/local_variable_test.dart
index 284020f..c1481fb 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/local_variable_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/local_variable_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/named_argument_test.dart b/pkg/analysis_server/test/services/completion/dart/relevance/named_argument_test.dart
index b9c200d..ff02ed2 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/named_argument_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/named_argument_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../../../src/utilities/mock_packages.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/non_type_member_test.dart b/pkg/analysis_server/test/services/completion/dart/relevance/non_type_member_test.dart
index 27f3789..084c91c 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/non_type_member_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/non_type_member_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/static_member_test.dart b/pkg/analysis_server/test/services/completion/dart/relevance/static_member_test.dart
index 7042169..314b1e0 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/static_member_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/static_member_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'completion_relevance.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/test_all.dart b/pkg/analysis_server/test/services/completion/dart/relevance/test_all.dart
index d6bf383..d6679e5 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/test_all.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'bool_assignment_test.dart' as bool_assignments;
diff --git a/pkg/analysis_server/test/services/completion/dart/test_all.dart b/pkg/analysis_server/test/services/completion/dart/test_all.dart
index 7e3c13c..c8ccce6 100644
--- a/pkg/analysis_server/test/services/completion/dart/test_all.dart
+++ b/pkg/analysis_server/test/services/completion/dart/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'arglist_contributor_test.dart' as arglist_test;
diff --git a/pkg/analysis_server/test/services/completion/test_all.dart b/pkg/analysis_server/test/services/completion/test_all.dart
index 4aaa784..533fb7a 100644
--- a/pkg/analysis_server/test/services/completion/test_all.dart
+++ b/pkg/analysis_server/test/services/completion/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'dart/test_all.dart' as dart_all;
diff --git a/pkg/analysis_server/test/services/test_all.dart b/pkg/analysis_server/test/services/test_all.dart
index 85f29c1..954023d 100644
--- a/pkg/analysis_server/test/services/test_all.dart
+++ b/pkg/analysis_server/test/services/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'completion/test_all.dart' as completion_all;
diff --git a/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart b/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart
index 7057898..2cd24c1 100644
--- a/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/computer/imported_elements_computer.dart';
import 'package:analyzer/dart/analysis/results.dart';
@@ -21,9 +19,9 @@
@reflectiveTest
class ImportedElementsComputerTest extends AbstractContextTest {
- String sourcePath;
+ late String sourcePath;
- List<ImportedElements> importedElements;
+ late List<ImportedElements> importedElements;
void assertElements(List<ImportedElements> expectedElementsList) {
expect(importedElements, hasLength(expectedElementsList.length));
@@ -475,7 +473,7 @@
var result =
await session.getResolvedUnit2(sourcePath) as ResolvedUnitResult;
var computer = ImportedElementsComputer(
- result.unit, content.indexOf(selection), selection.length);
+ result.unit!, content.indexOf(selection), selection.length);
importedElements = computer.compute();
}
}
diff --git a/pkg/analysis_server/test/src/computer/test_all.dart b/pkg/analysis_server/test/src/computer/test_all.dart
index a1243b2..1a04173 100644
--- a/pkg/analysis_server/test/src/computer/test_all.dart
+++ b/pkg/analysis_server/test/src/computer/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'closing_labels_computer_test.dart' as closing_labels_computer;
diff --git a/pkg/analysis_server/test/src/domain_abstract_test.dart b/pkg/analysis_server/test/src/domain_abstract_test.dart
index 73c72eb..36ca0d3 100644
--- a/pkg/analysis_server/test/src/domain_abstract_test.dart
+++ b/pkg/analysis_server/test/src/domain_abstract_test.dart
@@ -2,17 +2,17 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/src/domain_abstract.dart';
import 'package:analysis_server/src/plugin/plugin_manager.dart';
import 'package:analysis_server/src/protocol_server.dart' hide Element;
+import 'package:analyzer/instrumentation/service.dart';
import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../analysis_abstract.dart';
+import 'plugin/plugin_manager_test.dart';
void main() {
defineReflectiveSuite(() {
@@ -38,8 +38,8 @@
Future<void> test_waitForResponses_nonEmpty_noTimeout_immediate() async {
AbstractRequestHandler handler = TestAbstractRequestHandler(server);
- PluginInfo plugin1 = DiscoveredPluginInfo('p1', '', '', null, null);
- PluginInfo plugin2 = DiscoveredPluginInfo('p2', '', '', null, null);
+ var plugin1 = _pluginInfo('p1');
+ var plugin2 = _pluginInfo('p2');
var response1 = plugin.Response('1', 1);
var response2 = plugin.Response('2', 2);
var futures = <PluginInfo, Future<plugin.Response>>{
@@ -52,8 +52,8 @@
Future<void> test_waitForResponses_nonEmpty_noTimeout_withError() async {
AbstractRequestHandler handler = TestAbstractRequestHandler(server);
- PluginInfo plugin1 = DiscoveredPluginInfo('p1', '', '', null, null);
- PluginInfo plugin2 = DiscoveredPluginInfo('p2', '', '', null, null);
+ var plugin1 = _pluginInfo('p1');
+ var plugin2 = _pluginInfo('p2');
var response1 = plugin.Response('1', 1);
var response2 = plugin.Response('2', 2,
error: plugin.RequestError(
@@ -68,9 +68,9 @@
Future<void> test_waitForResponses_nonEmpty_timeout_someDelayed() async {
AbstractRequestHandler handler = TestAbstractRequestHandler(server);
- PluginInfo plugin1 = DiscoveredPluginInfo('p1', '', '', null, null);
- PluginInfo plugin2 = DiscoveredPluginInfo('p2', '', '', null, null);
- PluginInfo plugin3 = DiscoveredPluginInfo('p3', '', '', null, null);
+ var plugin1 = _pluginInfo('p1');
+ var plugin2 = _pluginInfo('p2');
+ var plugin3 = _pluginInfo('p3');
var response1 = plugin.Response('1', 1);
var response2 = plugin.Response('2', 2);
var response3 = plugin.Response('3', 3);
@@ -82,6 +82,11 @@
var responses = await handler.waitForResponses(futures, timeout: 50);
expect(responses, unorderedEquals([response2]));
}
+
+ PluginInfo _pluginInfo(String path) {
+ return DiscoveredPluginInfo(path, '', '', TestNotificationManager(),
+ InstrumentationService.NULL_SERVICE);
+ }
}
class TestAbstractRequestHandler extends AbstractRequestHandler {
diff --git a/pkg/analysis_server/test/src/domains/completion/available_suggestion_sets_test.dart b/pkg/analysis_server/test/src/domains/completion/available_suggestion_sets_test.dart
index 32f0198..68ef83c 100644
--- a/pkg/analysis_server/test/src/domains/completion/available_suggestion_sets_test.dart
+++ b/pkg/analysis_server/test/src/domains/completion/available_suggestion_sets_test.dart
@@ -2,9 +2,8 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/src/protocol_server.dart';
+import 'package:collection/collection.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -471,16 +470,15 @@
}
static void assertNoSuggestion(AvailableSuggestionSet set, String label,
- {ElementKind kind}) {
- var suggestion = set.items.singleWhere(
- (s) => s.label == label && (kind == null || s.element.kind == kind),
- orElse: () => null);
+ {ElementKind? kind}) {
+ var suggestion = set.items.singleWhereOrNull(
+ (s) => s.label == label && (kind == null || s.element.kind == kind));
expect(suggestion, null);
}
static AvailableSuggestion _getSuggestion(
AvailableSuggestionSet set, String label,
- {ElementKind kind}) {
+ {ElementKind? kind}) {
return set.items.singleWhere(
(s) => s.label == label && (kind == null || s.element.kind == kind));
}
diff --git a/pkg/analysis_server/test/src/domains/completion/available_suggestions_base.dart b/pkg/analysis_server/test/src/domains/completion/available_suggestions_base.dart
index 76e3d5c..d9417a4 100644
--- a/pkg/analysis_server/test/src/domains/completion/available_suggestions_base.dart
+++ b/pkg/analysis_server/test/src/domains/completion/available_suggestions_base.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'dart:convert';
import 'package:analysis_server/protocol/protocol_constants.dart';
@@ -45,11 +43,11 @@
var params = CompletionAvailableSuggestionsParams.fromNotification(
notification,
);
- for (var set in params.changedLibraries) {
+ for (var set in params.changedLibraries!) {
idToSetMap[set.id] = set;
uriToSetMap[set.uri] = set;
}
- for (var id in params.removedLibraries) {
+ for (var id in params.removedLibraries!) {
var set = idToSetMap.remove(id);
uriToSetMap.remove(set?.uri);
}
@@ -69,9 +67,7 @@
/// Remove the set with the given [uri].
/// The set must be already received.
void removeSet(String uri) {
- var set = uriToSetMap.remove(uri);
- expect(set, isNotNull);
-
+ var set = uriToSetMap.remove(uri)!;
idToSetMap.remove(set.id);
}
diff --git a/pkg/analysis_server/test/src/domains/completion/get_suggestion_details_test.dart b/pkg/analysis_server/test/src/domains/completion/get_suggestion_details_test.dart
index 9b4d38a..9009034 100644
--- a/pkg/analysis_server/test/src/domains/completion/get_suggestion_details_test.dart
+++ b/pkg/analysis_server/test/src/domains/completion/get_suggestion_details_test.dart
@@ -2,10 +2,7 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/src/protocol_server.dart';
-import 'package:meta/meta.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -39,7 +36,7 @@
);
expect(result.completion, 'MyEnum.aaa');
- _assertTestFileChange(result.change, r'''
+ _assertTestFileChange(result.change!, r'''
import 'package:test/a.dart';
main() {} // ref
@@ -63,7 +60,7 @@
);
expect(result.completion, 'sin');
- _assertEmptyChange(result.change);
+ _assertEmptyChange(result.change!);
}
Future<void> test_existingImport_prefixed() async {
@@ -83,7 +80,7 @@
);
expect(result.completion, 'math.sin');
- _assertEmptyChange(result.change);
+ _assertEmptyChange(result.change!);
}
Future<void> test_invalid_library() async {
@@ -92,7 +89,7 @@
var response = await waitResponse(
_buildRequest(id: -1, label: 'foo', offset: 0),
);
- expect(response.error.code, RequestErrorCode.INVALID_PARAMETER);
+ expect(response.error!.code, RequestErrorCode.INVALID_PARAMETER);
}
Future<void> test_newImport() async {
@@ -110,7 +107,7 @@
);
expect(result.completion, 'sin');
- _assertTestFileChange(result.change, r'''
+ _assertTestFileChange(result.change!, r'''
import 'dart:math';
main() {} // ref
@@ -139,7 +136,7 @@
);
expect(result.completion, 'sin');
- _assertTestFileChange(result.change, r'''
+ _assertTestFileChange(result.change!, r'''
library foo;
import 'dart:math';
@@ -173,7 +170,7 @@
);
expect(result.completion, 'sin');
- _assertTestFileChange(result.change, r'''
+ _assertTestFileChange(result.change!, r'''
@myAnnotation
import 'dart:math';
@@ -205,7 +202,7 @@
);
expect(result.completion, 'sin');
- _assertTestFileChange(result.change, r'''
+ _assertTestFileChange(result.change!, r'''
import 'dart:async';
import 'dart:math';
@myAnnotation
@@ -237,7 +234,7 @@
);
expect(result.completion, 'sin');
- _assertTestFileChange(result.change, r'''
+ _assertTestFileChange(result.change!, r'''
import 'dart:math';
part 'a.dart';
@@ -260,10 +257,10 @@
}
Request _buildRequest({
- String file,
- @required int id,
- @required String label,
- @required int offset,
+ String? file,
+ required int id,
+ required String label,
+ required int offset,
}) {
return CompletionGetSuggestionDetailsParams(
file ?? testFile,
diff --git a/pkg/analysis_server/test/src/domains/completion/get_suggestions_available_test.dart b/pkg/analysis_server/test/src/domains/completion/get_suggestions_available_test.dart
index 9ec1326..195678c 100644
--- a/pkg/analysis_server/test/src/domains/completion/get_suggestions_available_test.dart
+++ b/pkg/analysis_server/test/src/domains/completion/get_suggestions_available_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/src/protocol_server.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -36,8 +34,7 @@
}
void _assertHasImport(String exportingUri, String declaringUri, String name) {
- var existingImports = fileToExistingImports[testFile];
- expect(existingImports, isNotNull);
+ var existingImports = fileToExistingImports[testFile]!;
var existingImport = existingImports.imports.singleWhere((import) =>
existingImports.elements.strings[import.uri] == exportingUri);
@@ -64,7 +61,7 @@
var results = await _getSuggestions(testFile, 0);
expect(results.includedElementKinds, isNotEmpty);
- var includedIdSet = results.includedSuggestionSets.map((set) => set.id);
+ var includedIdSet = results.includedSuggestionSets!.map((set) => set.id);
expect(includedIdSet, contains(mathSet.id));
expect(includedIdSet, contains(asyncSet.id));
}
@@ -107,7 +104,7 @@
unorderedEquals([ElementKind.CONSTRUCTOR]),
);
- var includedIdSet = results.includedSuggestionSets.map((set) => set.id);
+ var includedIdSet = results.includedSuggestionSets!.map((set) => set.id);
expect(includedIdSet, contains(mathSet.id));
expect(includedIdSet, contains(asyncSet.id));
}
@@ -140,7 +137,7 @@
var results = await _getSuggestions(testPath, 0);
expect(
- results.includedSuggestionSets.singleWhere((set) {
+ results.includedSuggestionSets!.singleWhere((set) {
return set.id == aSet.id;
}).displayUri,
'../a.dart',
@@ -156,7 +153,7 @@
var results = await _getSuggestions(testPath, 0);
expect(
- results.includedSuggestionSets.singleWhere((set) {
+ results.includedSuggestionSets!.singleWhere((set) {
return set.id == aSet.id;
}).displayUri,
isNull,
@@ -242,7 +239,7 @@
testCode.indexOf('); // ref'),
);
- var includedTags = results.includedSuggestionRelevanceTags;
+ var includedTags = results.includedSuggestionRelevanceTags!;
int findBoost(String tag) {
for (var includedTag in includedTags) {
if (includedTag.tag == tag) {
@@ -276,7 +273,7 @@
testCode.indexOf(' // ref'),
);
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags!, r'''
[
{
"tag": "ElementKind.PREFIX",
@@ -340,7 +337,7 @@
testCode.indexOf('); // ref'),
);
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags!, r'''
[
{
"tag": "ElementKind.PREFIX",
@@ -404,7 +401,7 @@
testCode.indexOf('); // ref'),
);
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags!, r'''
[
{
"tag": "ElementKind.MIXIN",
@@ -475,7 +472,7 @@
testCode.indexOf(' // ref'),
);
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags!, r'''
[
{
"tag": "ElementKind.PREFIX",
@@ -535,7 +532,7 @@
testCode.indexOf(' // ref'),
);
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags!, r'''
[
{
"tag": "ElementKind.MIXIN",
@@ -605,7 +602,7 @@
testCode.indexOf(']; // ref'),
);
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags!, r'''
[
{
"tag": "dart:core::int",
diff --git a/pkg/analysis_server/test/src/domains/completion/test_all.dart b/pkg/analysis_server/test/src/domains/completion/test_all.dart
index dc4bd6b..1452e21 100644
--- a/pkg/analysis_server/test/src/domains/completion/test_all.dart
+++ b/pkg/analysis_server/test/src/domains/completion/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'available_suggestion_sets_test.dart' as available_suggestion_sets;
diff --git a/pkg/analysis_server/test/src/domains/flutter/base.dart b/pkg/analysis_server/test/src/domains/flutter/base.dart
index 88d9c9d..2cadf8b 100644
--- a/pkg/analysis_server/test/src/domains/flutter/base.dart
+++ b/pkg/analysis_server/test/src/domains/flutter/base.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/src/flutter/flutter_domain.dart';
import 'package:analysis_server/src/protocol_server.dart';
import 'package:test/test.dart';
diff --git a/pkg/analysis_server/test/src/domains/flutter/get_widget_description_test.dart b/pkg/analysis_server/test/src/domains/flutter/get_widget_description_test.dart
index fe6b73a..39baacd 100644
--- a/pkg/analysis_server/test/src/domains/flutter/get_widget_description_test.dart
+++ b/pkg/analysis_server/test/src/domains/flutter/get_widget_description_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/src/protocol_server.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -34,7 +32,7 @@
expect(property.expression, "'aaa'");
expect(property.isRequired, isTrue);
expect(property.editor, isNotNull);
- expect(property.value.stringValue, 'aaa');
+ expect(property.value!.stringValue, 'aaa');
}
Future<void> test_notInstanceCreation() async {
@@ -46,7 +44,7 @@
var response = await getWidgetDescriptionResponse('42');
expect(
- response.error.code,
+ response.error!.code,
RequestErrorCode.FLUTTER_GET_WIDGET_DESCRIPTION_NO_WIDGET,
);
}
@@ -60,7 +58,7 @@
var response = await getWidgetDescriptionResponse('new Foo');
expect(
- response.error.code,
+ response.error!.code,
RequestErrorCode.FLUTTER_GET_WIDGET_DESCRIPTION_NO_WIDGET,
);
}
diff --git a/pkg/analysis_server/test/src/domains/flutter/set_property_value_test.dart b/pkg/analysis_server/test/src/domains/flutter/set_property_value_test.dart
index 10c2eb9..56a8c90 100644
--- a/pkg/analysis_server/test/src/domains/flutter/set_property_value_test.dart
+++ b/pkg/analysis_server/test/src/domains/flutter/set_property_value_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/src/protocol_server.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -135,7 +133,7 @@
Future<FlutterSetWidgetPropertyValueResult> _setValue(
FlutterWidgetProperty property,
- FlutterWidgetPropertyValue value,
+ FlutterWidgetPropertyValue? value,
) async {
var response = await _setValueResponse(property, value);
expect(response.error, isNull);
@@ -144,7 +142,7 @@
Future<Response> _setValueResponse(
FlutterWidgetProperty property,
- FlutterWidgetPropertyValue value,
+ FlutterWidgetPropertyValue? value,
) async {
var request = FlutterSetWidgetPropertyValueParams(
property.id,
diff --git a/pkg/analysis_server/test/src/domains/flutter/test_all.dart b/pkg/analysis_server/test/src/domains/flutter/test_all.dart
index 97e2c81..2030531 100644
--- a/pkg/analysis_server/test/src/domains/flutter/test_all.dart
+++ b/pkg/analysis_server/test/src/domains/flutter/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'get_widget_description_test.dart' as get_widget_description;
diff --git a/pkg/analysis_server/test/src/domains/test_all.dart b/pkg/analysis_server/test/src/domains/test_all.dart
index dc9a595..dac4cfe 100644
--- a/pkg/analysis_server/test/src/domains/test_all.dart
+++ b/pkg/analysis_server/test/src/domains/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'completion/test_all.dart' as completion;
diff --git a/pkg/analysis_server/test/src/flutter/flutter_outline_notification_test.dart b/pkg/analysis_server/test/src/flutter/flutter_outline_notification_test.dart
index 7096a77..6d57e25 100644
--- a/pkg/analysis_server/test/src/flutter/flutter_outline_notification_test.dart
+++ b/pkg/analysis_server/test/src/flutter/flutter_outline_notification_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'dart:async';
import 'package:analysis_server/protocol/protocol.dart';
@@ -25,15 +23,16 @@
@reflectiveTest
class FlutterNotificationOutlineTest extends AbstractAnalysisTest {
- Folder flutterFolder;
+ late Folder flutterFolder;
final Map<FlutterService, List<String>> flutterSubscriptions = {};
final Completer<void> _outlineReceived = Completer();
- FlutterOutline outline;
+ late FlutterOutline outline;
FlutterDomainHandler get flutterHandler =>
- server.handlers.singleWhere((handler) => handler is FlutterDomainHandler);
+ server.handlers.singleWhere((handler) => handler is FlutterDomainHandler)
+ as FlutterDomainHandler;
void addFlutterSubscription(FlutterService service, String file) {
// add file to subscription
@@ -97,25 +96,25 @@
await prepareOutline();
var unitOutline = outline;
- var myWidgetOutline = unitOutline.children[0];
+ var myWidgetOutline = unitOutline.children![0];
expect(myWidgetOutline.kind, FlutterOutlineKind.DART_ELEMENT);
- expect(myWidgetOutline.dartElement.name, 'MyWidget');
+ expect(myWidgetOutline.dartElement!.name, 'MyWidget');
- var buildOutline = myWidgetOutline.children[0];
+ var buildOutline = myWidgetOutline.children![0];
expect(buildOutline.kind, FlutterOutlineKind.DART_ELEMENT);
- expect(buildOutline.dartElement.name, 'build');
+ expect(buildOutline.dartElement!.name, 'build');
- var columnOutline = buildOutline.children[0];
+ var columnOutline = buildOutline.children![0];
expect(columnOutline.kind, FlutterOutlineKind.NEW_INSTANCE);
expect(columnOutline.className, 'Column');
expect(columnOutline.children, hasLength(2));
- var textOutlineA = columnOutline.children[0];
+ var textOutlineA = columnOutline.children![0];
expect(textOutlineA.kind, FlutterOutlineKind.NEW_INSTANCE);
expect(textOutlineA.className, 'Text');
expect(textOutlineA.offset, code.indexOf("const Text('aaa')"));
- var textOutlineB = columnOutline.children[1];
+ var textOutlineB = columnOutline.children![1];
expect(textOutlineB.kind, FlutterOutlineKind.NEW_INSTANCE);
expect(textOutlineB.className, 'Text');
expect(textOutlineB.offset, code.indexOf("const Text('bbb')"));
diff --git a/pkg/analysis_server/test/src/flutter/test_all.dart b/pkg/analysis_server/test/src/flutter/test_all.dart
index 54e575a..48db007 100644
--- a/pkg/analysis_server/test/src/flutter/test_all.dart
+++ b/pkg/analysis_server/test/src/flutter/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'flutter_outline_computer_test.dart' as outline_computer;
diff --git a/pkg/analysis_server/test/src/services/completion/dart/completion_test.dart b/pkg/analysis_server/test/src/services/completion/dart/completion_test.dart
index c9c355e..004e07b 100644
--- a/pkg/analysis_server/test/src/services/completion/dart/completion_test.dart
+++ b/pkg/analysis_server/test/src/services/completion/dart/completion_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/src/protocol_server.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analysis_server/test/src/services/completion/dart/test_all.dart b/pkg/analysis_server/test/src/services/completion/dart/test_all.dart
index 06a051a..ab0ad81 100644
--- a/pkg/analysis_server/test/src/services/completion/dart/test_all.dart
+++ b/pkg/analysis_server/test/src/services/completion/dart/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'completion_test.dart' as completion;
diff --git a/pkg/analysis_server/test/src/services/completion/test_all.dart b/pkg/analysis_server/test/src/services/completion/test_all.dart
index 75303aa..19d31b3 100644
--- a/pkg/analysis_server/test/src/services/completion/test_all.dart
+++ b/pkg/analysis_server/test/src/services/completion/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'dart/test_all.dart' as dart;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/test_all.dart
index f393c9b..a21ba3c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'add_type_parameter_test.dart' as add_type_parameter;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_manager_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_manager_test.dart
index 60665b9..d182ab1 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_manager_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_manager_test.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:analysis_server/src/services/correction/fix/data_driven/transform_set_manager.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/session.dart';
@@ -38,7 +36,7 @@
var testFile = convertPath('/home/test/lib/test.dart');
addSource(testFile, '');
var result = await session.getResolvedLibraryValid(testFile);
- var sets = manager.forLibrary(result.element);
+ var sets = manager.forLibrary(result.element!);
expect(sets, hasLength(2));
}
@@ -49,7 +47,7 @@
var testFile = convertPath('/home/test/lib/test.dart');
addSource(testFile, '');
var result = await session.getResolvedLibraryValid(testFile);
- var sets = manager.forLibrary(result.element);
+ var sets = manager.forLibrary(result.element!);
expect(sets, hasLength(0));
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
index 8d78b42..570d7a8 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'add_async_test.dart' as add_async;
diff --git a/pkg/analysis_server/test/src/services/correction/test_all.dart b/pkg/analysis_server/test/src/services/correction/test_all.dart
index 96c3fa6..abc5ddb 100644
--- a/pkg/analysis_server/test/src/services/correction/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'assist/test_all.dart' as assist_all;
diff --git a/pkg/analysis_server/test/src/services/test_all.dart b/pkg/analysis_server/test/src/services/test_all.dart
index 2c3be26..e5d8aa0 100644
--- a/pkg/analysis_server/test/src/services/test_all.dart
+++ b/pkg/analysis_server/test/src/services/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'completion/test_all.dart' as completion;
diff --git a/pkg/analysis_server/test/src/test_all.dart b/pkg/analysis_server/test/src/test_all.dart
index ce38f77..0cb76aa 100644
--- a/pkg/analysis_server/test/src/test_all.dart
+++ b/pkg/analysis_server/test/src/test_all.dart
@@ -2,8 +2,6 @@
// 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.
-// @dart = 2.9
-
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'cider/test_all.dart' as cider;