Version 2.16.0-75.0.dev
Merge commit '2dbb4d4536b0c7815d87690174bd77ea76296f18' into 'dev'
diff --git a/DEPS b/DEPS
index 74b90b2..5cf2d6e 100644
--- a/DEPS
+++ b/DEPS
@@ -65,8 +65,8 @@
# The list of revisions for these tools comes from Fuchsia, here:
# https://fuchsia.googlesource.com/integration/+/HEAD/prebuilts
# If there are problems with the toolchain, contact fuchsia-toolchain@.
- "clang_revision": "f37e8b0b831e61d3b6033829fff05d6d193ab735",
- "gn_revision": "693f9fb87e4febdd4299db9f73d8d2c958e63148",
+ "clang_revision": "e3a7f0e2f9ab566bd9b71fb54fe77e947b061a12",
+ "gn_revision": "b79031308cc878488202beb99883ec1f2efd9a6d",
# Scripts that make 'git cl format' work.
"clang_format_scripts_rev": "c09c8deeac31f05bd801995c475e7c8070f9ecda",
diff --git a/pkg/analysis_server/analysis_options.yaml b/pkg/analysis_server/analysis_options.yaml
index 90f1d22..e737f27 100644
--- a/pkg/analysis_server/analysis_options.yaml
+++ b/pkg/analysis_server/analysis_options.yaml
@@ -2,6 +2,7 @@
analyzer:
# This currently finds ~1,200 implicit-casts issues when enabled.
+ # TODO(srawlins): Switch to strict-casts
# strong-mode:
# implicit-casts: false
exclude:
diff --git a/pkg/analysis_server/benchmark/benchmarks.dart b/pkg/analysis_server/benchmark/benchmarks.dart
index 0d3904b..78a1b36 100644
--- a/pkg/analysis_server/benchmark/benchmarks.dart
+++ b/pkg/analysis_server/benchmark/benchmarks.dart
@@ -222,16 +222,20 @@
@override
Future run() async {
- if (argResults!.rest.isEmpty) {
+ var args = argResults;
+ if (args == null) {
+ throw StateError('argResults have not been set');
+ }
+ if (args.rest.isEmpty) {
printUsage();
exit(1);
}
- var benchmarkId = argResults!.rest.first;
- var repeatCount = int.parse(argResults!['repeat'] as String);
- var flutterRepository = argResults!['flutter-repository'] as String?;
- var quick = argResults!['quick'];
- var verbose = argResults!['verbose'];
+ var benchmarkId = args.rest.first;
+ var repeatCount = int.parse(args['repeat'] as String);
+ var flutterRepository = args['flutter-repository'] as String?;
+ var quick = args['quick'] as bool;
+ var verbose = args['verbose'] as bool;
var benchmark =
benchmarks.firstWhere((b) => b.id == benchmarkId, orElse: () {
diff --git a/pkg/analysis_server/benchmark/integration/input_converter.dart b/pkg/analysis_server/benchmark/integration/input_converter.dart
index da47e28..aec8d14 100644
--- a/pkg/analysis_server/benchmark/integration/input_converter.dart
+++ b/pkg/analysis_server/benchmark/integration/input_converter.dart
@@ -62,7 +62,7 @@
/// Return an operation for the notification or `null` if none.
Operation? convertNotification(Map<String, dynamic> json) {
- String event = json['event'];
+ var event = json['event'] as String;
if (event == SERVER_NOTIFICATION_STATUS) {
// {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
var params = asMap2(json['params']);
@@ -214,21 +214,21 @@
/// Recursively translate source paths in the specified JSON to reference
/// the temporary source used during performance measurement rather than
/// the original source when the instrumentation or log file was generated.
- dynamic translateSrcPaths(json) {
+ Object? translateSrcPaths(Object? json) {
if (json is String) {
return srcPathMap.translate(json);
}
if (json is List) {
- var result = [];
+ var result = <Object?>[];
for (var i = 0; i < json.length; ++i) {
- result.add(translateSrcPaths(json[i]));
+ result.add(translateSrcPaths(json[i] as Object?));
}
return result;
}
if (json is Map) {
var result = <String, Object?>{};
json.forEach((origKey, value) {
- result[translateSrcPaths(origKey)] = translateSrcPaths(value);
+ result[translateSrcPaths(origKey) as String] = translateSrcPaths(value);
});
return result;
}
diff --git a/pkg/analysis_server/benchmark/integration/main.dart b/pkg/analysis_server/benchmark/integration/main.dart
index b63675e..07ce8bb 100644
--- a/pkg/analysis_server/benchmark/integration/main.dart
+++ b/pkg/analysis_server/benchmark/integration/main.dart
@@ -130,8 +130,8 @@
printHelp();
exit(1);
}
-
- var showHelp = args[HELP_CMDLINE_OPTION] || args.rest.isNotEmpty;
+ var helpArg = args[HELP_CMDLINE_OPTION] as bool;
+ var showHelp = helpArg || args.rest.isNotEmpty;
var inputArg = args[INPUT_CMDLINE_OPTION];
if (inputArg is! String || inputArg.isEmpty) {
@@ -141,7 +141,8 @@
perfArgs.inputPath = inputArg;
}
- for (var pair in args[MAP_OPTION]) {
+ var mapArg = args[MAP_OPTION] as List<Object?>;
+ for (var pair in mapArg) {
if (pair is String) {
var index = pair.indexOf(',');
if (index != -1 && !pair.contains(',', index + 1)) {
@@ -175,9 +176,10 @@
}
}
- if (args[VERY_VERBOSE_CMDLINE_OPTION] || rawArgs.contains('-vv')) {
+ var verboseArg = args[VERY_VERBOSE_CMDLINE_OPTION] as bool;
+ if (verboseArg || rawArgs.contains('-vv')) {
Logger.root.level = Level.FINE;
- } else if (args[VERBOSE_CMDLINE_OPTION]) {
+ } else if (verboseArg) {
Logger.root.level = Level.INFO;
} else {
Logger.root.level = Level.WARNING;
diff --git a/pkg/analysis_server/benchmark/integration/operation.dart b/pkg/analysis_server/benchmark/integration/operation.dart
index 311e979..db0bfcf 100644
--- a/pkg/analysis_server/benchmark/integration/operation.dart
+++ b/pkg/analysis_server/benchmark/integration/operation.dart
@@ -70,8 +70,8 @@
@override
Future<void>? perform(Driver driver) {
var stopwatch = Stopwatch();
- String originalId = json['id'];
- String method = json['method'];
+ var originalId = json['id'] as String;
+ var method = json['method'] as String;
json['clientRequestTime'] = DateTime.now().millisecondsSinceEpoch;
driver.logger.log(Level.FINE, 'Sending request: $method\n $json');
stopwatch.start();
diff --git a/pkg/analysis_server/benchmark/perf/memory_tests.dart b/pkg/analysis_server/benchmark/perf/memory_tests.dart
index 528f672..1837834 100644
--- a/pkg/analysis_server/benchmark/perf/memory_tests.dart
+++ b/pkg/analysis_server/benchmark/perf/memory_tests.dart
@@ -230,7 +230,7 @@
Map<String, List<Diagnostic>> currentAnalysisErrors = {};
@override
- void expect(actual, matcher, {String? reason}) =>
+ void expect(Object? actual, Matcher matcher, {String? reason}) =>
outOfTestExpect(actual, matcher, reason: reason);
/// The server is automatically started before every test.
@@ -265,8 +265,8 @@
var total = 0;
- List isolateGroupsRefs = vm['isolateGroups'];
- for (Map isolateGroupRef in isolateGroupsRefs) {
+ var isolateGroupsRefs = vm['isolateGroups'] as List<Object?>;
+ for (var isolateGroupRef in isolateGroupsRefs.cast<Map>()) {
final heapUsage = await service.call('getIsolateGroupMemoryUsage',
{'isolateGroupId': isolateGroupRef['id']});
total += heapUsage['heapUsage'] + heapUsage['externalUsage'] as int;
@@ -312,10 +312,10 @@
}
try {
- dynamic json = jsonDecode(message);
+ var json = jsonDecode(message) as Map<Object?, Object?>;
if (json.containsKey('id')) {
- dynamic id = json['id'];
- _completers[id]?.complete(json['result']);
+ var id = json['id'];
+ _completers[id]?.complete(json['result'] as Map<Object?, Object?>);
_completers.remove(id);
}
} catch (e) {
diff --git a/pkg/analysis_server/lib/protocol/protocol.dart b/pkg/analysis_server/lib/protocol/protocol.dart
index 9d15dac..263083a 100644
--- a/pkg/analysis_server/lib/protocol/protocol.dart
+++ b/pkg/analysis_server/lib/protocol/protocol.dart
@@ -37,7 +37,7 @@
/// Initialize a newly created instance based on the given JSON data.
factory Notification.fromJson(Map json) {
- return Notification(json[Notification.EVENT],
+ return Notification(json[Notification.EVENT] as String,
json[Notification.PARAMS] as Map<String, Object>?);
}
diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart
index 082036f..bfdf408 100644
--- a/pkg/analysis_server/lib/protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart
@@ -11565,7 +11565,7 @@
double? doubleValue;
if (json.containsKey('doubleValue')) {
doubleValue = jsonDecoder.decodeDouble(
- jsonPath + '.doubleValue', json['doubleValue']);
+ jsonPath + '.doubleValue', json['doubleValue'] as Object);
}
int? intValue;
if (json.containsKey('intValue')) {
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index d727774..09fdeee 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -5,8 +5,6 @@
import 'package:analyzer/dart/analysis/analysis_context.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/session.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/visitor.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/analysis_context_collection.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
@@ -23,24 +21,6 @@
import 'src/utilities/mock_packages.dart';
-/// Finds an [Element] with the given [name].
-Element? findChildElement(Element root, String name, [ElementKind? kind]) {
- Element? result;
- root.accept(_ElementVisitorFunctionWrapper((Element element) {
- if (element.name != name) {
- return;
- }
- if (kind != null && element.kind != kind) {
- return;
- }
- result = element;
- }));
- return result;
-}
-
-/// A function to be called for every [Element].
-typedef _ElementVisitorFunction = void Function(Element element);
-
class AbstractContextTest with ResourceProviderMixin {
static bool _lintRulesAreRegistered = false;
@@ -65,6 +45,13 @@
throw 0;
}
+ /// Return a list of the experiments that are to be enabled for tests in this
+ /// class, an empty list if there are no experiments that should be enabled.
+ List<String> get experiments => [
+ EnableString.constructor_tearoffs,
+ EnableString.named_arguments_anywhere,
+ ];
+
String get latestLanguageVersion =>
'${ExperimentStatus.currentVersion.major}.'
'${ExperimentStatus.currentVersion.minor}';
@@ -192,6 +179,10 @@
);
writeTestPackageConfig();
+
+ createAnalysisOptionsFile(
+ experiments: experiments,
+ );
}
void setupResourceProvider() {}
@@ -302,16 +293,3 @@
verifyCreatedCollection();
}
}
-
-/// Wraps the given [_ElementVisitorFunction] into an instance of
-/// [engine.GeneralizingElementVisitor].
-class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor<void> {
- final _ElementVisitorFunction function;
- _ElementVisitorFunctionWrapper(this.function);
-
- @override
- void visitElement(Element element) {
- function(element);
- super.visitElement(element);
- }
-}
diff --git a/pkg/analysis_server/test/abstract_single_unit.dart b/pkg/analysis_server/test/abstract_single_unit.dart
index b18416c..67aa683 100644
--- a/pkg/analysis_server/test/abstract_single_unit.dart
+++ b/pkg/analysis_server/test/abstract_single_unit.dart
@@ -94,6 +94,6 @@
@override
void setUp() {
super.setUp();
- testFile = convertPath('/home/test/lib/test.dart');
+ testFile = convertPath('$testPackageLibPath/test.dart');
}
}
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index 8ea43c3..317cc59 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -18,6 +18,8 @@
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:analyzer_plugin/src/protocol/protocol_internal.dart'
+ show HasToJson;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -1580,7 +1582,7 @@
}
/// Send an `updateContent` request for [testFile].
- void sendContentChange(dynamic contentChange) {
+ void sendContentChange(HasToJson contentChange) {
var request =
AnalysisUpdateContentParams({testFile: contentChange}).toRequest('0');
handleSuccessfulRequest(request);
diff --git a/pkg/analysis_server/test/integration/support/integration_tests.dart b/pkg/analysis_server/test/integration/support/integration_tests.dart
index 6ca048e..3ef73c2 100644
--- a/pkg/analysis_server/test/integration/support/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/support/integration_tests.dart
@@ -41,7 +41,7 @@
Matcher isOneOf(List<Matcher> choiceMatchers) => _OneOf(choiceMatchers);
/// Assert that [actual] matches [matcher].
-void outOfTestExpect(actual, Matcher matcher,
+void outOfTestExpect(Object? actual, Matcher matcher,
{String? reason, skip, bool verbose = false}) {
var matchState = {};
try {
@@ -377,8 +377,8 @@
description.add(this.description);
@override
- void populateMismatches(item, List<MismatchDescriber> mismatches) {
- if (item is! Map) {
+ void populateMismatches(Object? item, List<MismatchDescriber> mismatches) {
+ if (item is! Map<String, Object?>) {
mismatches.add(simpleDescription('is not a map'));
return;
}
@@ -535,7 +535,7 @@
_recordStdio('<== $trimmedLine');
Map message;
try {
- message = json.decoder.convert(trimmedLine);
+ message = json.decoder.convert(trimmedLine) as Map<Object?, Object?>;
} catch (exception) {
_badDataFromServer('JSON decode failure: $exception');
return;
@@ -543,7 +543,7 @@
outOfTestExpect(message, isMap);
if (message.containsKey('id')) {
outOfTestExpect(message['id'], isString);
- String id = message['id'];
+ var id = message['id'] as String;
var completer = _pendingCommands[id];
if (completer == null) {
fail('Unexpected response from server: id=$id');
@@ -553,7 +553,7 @@
if (message.containsKey('error')) {
completer.completeError(ServerErrorMessage(message));
} else {
- completer.complete(message['result']);
+ completer.complete(message['result'] as Map<String, Object?>?);
}
// Check that the message is well-formed. We do this after calling
// completer.complete() or completer.completeError() so that we don't
@@ -564,7 +564,8 @@
// params.
outOfTestExpect(message, contains('event'));
outOfTestExpect(message['event'], isString);
- notificationProcessor(message['event'], message['params']);
+ notificationProcessor(message['event'] as String,
+ message['params'] as Map<Object?, Object?>);
// Check that the message is well-formed. We do this after calling
// notificationController.add() so that we don't stall the test in the
// event of an error.
diff --git a/pkg/analysis_server/test/lsp/code_actions_assists_test.dart b/pkg/analysis_server/test/lsp/code_actions_assists_test.dart
index d814a75..cf67637f 100644
--- a/pkg/analysis_server/test/lsp/code_actions_assists_test.dart
+++ b/pkg/analysis_server/test/lsp/code_actions_assists_test.dart
@@ -457,5 +457,5 @@
_RawParams(this._json);
@override
- Object toJson() => jsonDecode(_json);
+ Object toJson() => jsonDecode(_json) as Object;
}
diff --git a/pkg/analysis_server/test/lsp/server_abstract.dart b/pkg/analysis_server/test/lsp/server_abstract.dart
index e46aa1b..851966e 100644
--- a/pkg/analysis_server/test/lsp/server_abstract.dart
+++ b/pkg/analysis_server/test/lsp/server_abstract.dart
@@ -261,9 +261,11 @@
void mergeJson(Map<String, dynamic> source, Map<String, dynamic> dest) {
source.keys.forEach((key) {
- if (source[key] is Map<String, dynamic> &&
- dest[key] is Map<String, dynamic>) {
- mergeJson(source[key], dest[key]);
+ var sourceValue = source[key];
+ var destValue = dest[key];
+ if (sourceValue is Map<String, dynamic> &&
+ destValue is Map<String, dynamic>) {
+ mergeJson(sourceValue, destValue);
} else {
dest[key] = source[key];
}
@@ -878,7 +880,7 @@
return expectSuccessfulResponseTo(request, (result) => result);
}
- void expect(actual, matcher, {String? reason}) =>
+ void expect(Object? actual, Matcher matcher, {String? reason}) =>
test.expect(actual, matcher, reason: reason);
void expectDocumentVersion(
@@ -1194,7 +1196,7 @@
Future<List<Location>> getReferences(
Uri uri,
Position pos, {
- includeDeclarations = false,
+ bool includeDeclarations = false,
}) {
final request = makeRequest(
Method.textDocument_references,
diff --git a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
index 690b251..4c2e182 100644
--- a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
@@ -123,7 +123,7 @@
class ArgListContributorTest extends DartCompletionContributorTest
with ArgListContributorMixin {
Future<void> test_Annotation_imported_constructor_named_param() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library libA; class A { const A({int one, String two: 'defaultValue'}); }''');
addTestSource('import "a.dart"; @A(^) main() { }');
await computeSuggestions();
@@ -132,7 +132,7 @@
}
Future<void> test_Annotation_importedConstructor_prefixed() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
const A({int value});
}
@@ -581,7 +581,8 @@
Future<void> test_ArgumentList_imported_constructor_named_param() async {
// ArgumentList InstanceCreationExpression ExpressionStatement
- addSource('/home/test/lib/a.dart', 'library libA; class A{A({int one}); }');
+ addSource(
+ '$testPackageLibPath/a.dart', 'library libA; class A{A({int one}); }');
addTestSource('import "a.dart"; main() { new A(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
@@ -589,8 +590,8 @@
Future<void> test_ArgumentList_imported_constructor_named_param2() async {
// ArgumentList InstanceCreationExpression ExpressionStatement
- addSource(
- '/home/test/lib/a.dart', 'library libA; class A{A.foo({int one}); }');
+ addSource('$testPackageLibPath/a.dart',
+ 'library libA; class A{A.foo({int one}); }');
addTestSource('import "a.dart"; main() { new A.foo(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
@@ -599,7 +600,7 @@
Future<void>
test_ArgumentList_imported_constructor_named_typed_param() async {
// ArgumentList InstanceCreationExpression VariableDeclaration
- addSource('/home/test/lib/a.dart',
+ addSource('$testPackageLibPath/a.dart',
'library libA; class A { A({int i, String s, d}) {} }}');
addTestSource('import "a.dart"; main() { var a = new A(^);}');
await computeSuggestions();
@@ -609,7 +610,7 @@
Future<void> test_ArgumentList_imported_factory_named_param() async {
// ArgumentList InstanceCreationExpression ExpressionStatement
- addSource('/home/test/lib/a.dart',
+ addSource('$testPackageLibPath/a.dart',
'library libA; class A{factory A({int one}) => throw 0;}');
addTestSource('import "a.dart"; main() { new A(^);}');
await computeSuggestions();
@@ -618,7 +619,7 @@
Future<void> test_ArgumentList_imported_factory_named_param2() async {
// ArgumentList InstanceCreationExpression ExpressionStatement
- addSource('/home/test/lib/a.dart',
+ addSource('$testPackageLibPath/a.dart',
'library libA; abstract class A{factory A.foo({int one});}');
addTestSource('import "a.dart"; main() { new A.foo(^);}');
await computeSuggestions();
@@ -627,7 +628,7 @@
Future<void> test_ArgumentList_imported_factory_named_typed_param() async {
// ArgumentList InstanceCreationExpression VariableDeclaration
- addSource('/home/test/lib/a.dart',
+ addSource('$testPackageLibPath/a.dart',
'library libA; class A {factory A({int i, String s, d}) {} }}');
addTestSource('import "a.dart"; main() { var a = new A(^);}');
await computeSuggestions();
@@ -637,7 +638,7 @@
Future<void> test_ArgumentList_imported_function_0() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
expect() { }
@@ -653,7 +654,7 @@
Future<void> test_ArgumentList_imported_function_3a() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg1, int arg2, {bool arg3}) { }
@@ -669,7 +670,7 @@
Future<void> test_ArgumentList_imported_function_3b() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg1, int arg2, {bool arg3}) { }
@@ -685,7 +686,7 @@
Future<void> test_ArgumentList_imported_function_3c() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg1, int arg2, {bool arg3}) { }
@@ -701,7 +702,7 @@
Future<void> test_ArgumentList_imported_function_3d() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg1, int arg2, {bool arg3}) { }
@@ -1084,7 +1085,7 @@
Future<void> test_ArgumentList_local_method_0() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@@ -1111,7 +1112,7 @@
}
Future<void> test_ArgumentList_nnbd_function_named_param_imported() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
f({int? nullable, int nonnullable}) {}''');
createAnalysisOptionsFile(experiments: [EnableString.non_nullable]);
addTestSource(r'''
@@ -1126,7 +1127,7 @@
}
Future<void> test_ArgumentList_nnbd_function_named_param_legacy() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
// @dart = 2.8
f({int named}) {}''');
addTestSource(r'''
diff --git a/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
index 3099fcf..a04f0be 100644
--- a/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
@@ -41,17 +41,17 @@
Future<void> test_Combinator_hide() async {
// SimpleIdentifier HideCombinator ImportDirective
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
library libAB;
part "ab_part.dart";
class A { }
class B { }''');
- addSource('/home/test/lib/ab_part.dart', '''
+ addSource('$testPackageLibPath/ab_part.dart', '''
part of libAB;
var T1;
PB F1() => new PB();
class PB { }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@@ -81,20 +81,20 @@
Future<void> test_Combinator_show() async {
// SimpleIdentifier HideCombinator ImportDirective
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
library libAB;
part "ab_part.dart";
class A { }
class B { }
class _AB''');
- addSource('/home/test/lib/ab_part.dart', '''
+ addSource('$testPackageLibPath/ab_part.dart', '''
part of libAB;
var T1;
PB F1() => new PB();
typedef PB2 F2(int blat);
class Clz = Object with Object;
class PB { }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@@ -129,11 +129,11 @@
}
Future<void> test_Combinator_show_export_withShow() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
class A {}
class B {}
''');
- addSource('/home/test/lib/b.dart', r'''
+ addSource('$testPackageLibPath/b.dart', r'''
export 'a.dart' show A;
''');
addTestSource(r'''
@@ -152,10 +152,10 @@
}
Future<void> test_Combinator_show_recursive() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {}
''');
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
export 'a.dart';
export 'b.dart';
class B {}
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
index 83312b9..a8c7e39 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
@@ -609,7 +609,7 @@
@override
void setUp() {
super.setUp();
- testFile = convertPath('/home/test/lib/test.dart');
+ testFile = convertPath('$testPackageLibPath/test.dart');
}
CompletionSuggestion suggestionWith(
diff --git a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
index fae0f6f..534635b 100644
--- a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
@@ -36,7 +36,7 @@
class ImportedReferenceContributorTest extends DartCompletionContributorTest
with ImportedReferenceContributorMixin {
Future<void> test_Annotation_typeArguments() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class C {}
typedef T1 = void Function();
typedef T2 = List<int>;
@@ -67,7 +67,7 @@
Future<void> test_ArgDefaults_function_with_required_named() async {
writeTestPackageConfig(meta: true);
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib B;
import 'package:meta/meta.dart';
@@ -85,7 +85,7 @@
Future<void> test_ArgumentList() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@@ -110,7 +110,7 @@
Future<void> test_ArgumentList_imported_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(arg) { }
@@ -137,7 +137,7 @@
Future<void>
test_ArgumentList_InstanceCreationExpression_functionalArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@@ -167,7 +167,7 @@
Future<void> test_ArgumentList_InstanceCreationExpression_typedefArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
typedef Funct();
class A { A(Funct f) { } }
@@ -198,7 +198,7 @@
Future<void> test_ArgumentList_local_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@@ -224,7 +224,7 @@
Future<void> test_ArgumentList_local_method() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@@ -250,7 +250,7 @@
Future<void> test_ArgumentList_MethodInvocation_functionalArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@@ -280,7 +280,7 @@
Future<void> test_ArgumentList_MethodInvocation_methodArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@@ -309,7 +309,7 @@
Future<void> test_ArgumentList_namedParam() async {
// SimpleIdentifier NamedExpression ArgumentList MethodInvocation
// ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }''');
addTestSource('''
@@ -352,7 +352,7 @@
// value to the type it already has.
// SimpleIdentifier NamedType AsExpression IfStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
foo() { }
class A {} class B extends A {} class C extends B {}
class X {X.c(); X._d(); z() {}}''');
@@ -379,7 +379,7 @@
// value to the type it already has.
// SimpleIdentifier NamedType AsExpression IfStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
foo() { }
class A {} class B implements A {} class C implements B {}
class X {X.c(); X._d(); z() {}}''');
@@ -528,7 +528,7 @@
}
Future<void> test_AwaitExpression_function() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
Future y() async {return 0;}
''');
addTestSource('''
@@ -548,7 +548,7 @@
Future<void> test_AwaitExpression_inherited() async {
// SimpleIdentifier AwaitExpression ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib libB;
class A {
Future y() async { return 0; }
@@ -602,21 +602,21 @@
Future<void> test_Block() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -657,7 +657,7 @@
assertNotSuggested('x');
assertNotSuggested('partT8');
- assertSuggestClass('A', elemFile: '/home/test/lib/ab.dart');
+ assertSuggestClass('A', elemFile: '$testPackageLibPath/ab.dart');
if (suggestConstructorsWithoutNew) {
assertSuggestConstructor('A');
}
@@ -705,21 +705,21 @@
Future<void> test_Block_final() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -818,21 +818,21 @@
Future<void> test_Block_final_final() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -919,21 +919,21 @@
Future<void> test_Block_final_var() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -1017,21 +1017,21 @@
}
Future<void> test_Block_identifier_partial() async {
- resolveSource('/home/test/lib/ab.dart', '''
+ resolveSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B { }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class DF { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
class D3 { }
int T3;
@@ -1094,7 +1094,7 @@
Future<void> test_Block_inherited_imported() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
@@ -1148,21 +1148,21 @@
}
Future<void> test_Block_local_function() async {
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -1200,21 +1200,21 @@
Future<void> test_Block_partial_results() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B { }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -1252,7 +1252,7 @@
Future<void> test_CascadeExpression_selector1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import 'b.dart';
@@ -1277,7 +1277,7 @@
Future<void> test_CascadeExpression_selector2() async {
// SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import 'b.dart';
@@ -1300,7 +1300,7 @@
Future<void> test_CascadeExpression_selector2_withTrailingReturn() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import 'b.dart';
@@ -1395,7 +1395,7 @@
Future<void> test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1420,7 +1420,7 @@
Future<void> test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1441,7 +1441,7 @@
Future<void> test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1462,7 +1462,7 @@
Future<void> test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as Soo;
@@ -1483,7 +1483,7 @@
Future<void> test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1504,7 +1504,7 @@
Future<void> test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1525,7 +1525,7 @@
Future<void> test_Combinator_hide() async {
// SimpleIdentifier HideCombinator ImportDirective
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
library libAB;
part 'partAB.dart';
class A { }
@@ -1535,7 +1535,7 @@
var T1;
PB F1() => new PB();
class PB { }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@@ -1549,7 +1549,7 @@
Future<void> test_Combinator_show() async {
// SimpleIdentifier HideCombinator ImportDirective
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
library libAB;
part 'partAB.dart';
class A { }
@@ -1561,7 +1561,7 @@
typedef PB2 F2(int blat);
class Clz = Object with Object;
class PB { }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@@ -1575,7 +1575,7 @@
Future<void> test_ConditionalExpression_elseExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1595,7 +1595,7 @@
Future<void> test_ConditionalExpression_elseExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1624,7 +1624,7 @@
Future<void> test_ConditionalExpression_partial_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1644,7 +1644,7 @@
Future<void> test_ConditionalExpression_partial_thenExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1673,7 +1673,7 @@
Future<void> test_ConditionalExpression_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1694,7 +1694,7 @@
Future<void> test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@@ -1719,7 +1719,7 @@
Future<void> test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@@ -1820,7 +1820,7 @@
}
Future<void> test_doc_class() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
library A;
/// My class.
/// Short description.
@@ -1842,7 +1842,7 @@
}
Future<void> test_doc_function() async {
- resolveSource('/home/test/lib/a.dart', r'''
+ resolveSource('$testPackageLibPath/a.dart', r'''
library A;
/// My function.
/// Short description.
@@ -1861,7 +1861,7 @@
}
Future<void> test_doc_function_c_style() async {
- resolveSource('/home/test/lib/a.dart', r'''
+ resolveSource('$testPackageLibPath/a.dart', r'''
library A;
/**
* My function.
@@ -1882,7 +1882,7 @@
}
Future<void> test_enum() async {
- addSource('/home/test/lib/a.dart', 'library A; enum E { one, two }');
+ addSource('$testPackageLibPath/a.dart', 'library A; enum E { one, two }');
addTestSource('import "a.dart"; void f() {^}');
await computeSuggestions();
assertSuggestEnum('E');
@@ -1891,8 +1891,8 @@
}
Future<void> test_enum_deprecated() async {
- addSource(
- '/home/test/lib/a.dart', 'library A; @deprecated enum E { one, two }');
+ addSource('$testPackageLibPath/a.dart',
+ 'library A; @deprecated enum E { one, two }');
addTestSource('import "a.dart"; void f() {^}');
await computeSuggestions();
// TODO(danrube) investigate why suggestion/element is not deprecated
@@ -1903,7 +1903,7 @@
}
Future<void> test_enum_filter() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
enum E { one, two }
enum F { three, four }
''');
@@ -1929,7 +1929,7 @@
Future<void> test_ExpressionStatement_identifier() async {
// SimpleIdentifier ExpressionStatement Block
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
_B F1() { }
class A {int x;}
class _B { }''');
@@ -1959,7 +1959,7 @@
Future<void> test_ExpressionStatement_name() async {
// ExpressionStatement Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
B T1;
class B{}''');
addTestSource('''
@@ -1971,7 +1971,7 @@
}
Future<void> test_ExtendsClause() async {
- newFile('/home/test/lib/a.dart', content: 'class A {}');
+ newFile('$testPackageLibPath/a.dart', content: 'class A {}');
addTestSource('''
import 'a.dart';
@@ -1982,7 +1982,7 @@
}
Future<void> test_ExtensionDeclaration_extendedType() async {
- newFile('/home/test/lib/a.dart', content: 'class A {}');
+ newFile('$testPackageLibPath/a.dart', content: 'class A {}');
addTestSource('''
import 'a.dart';
@@ -1994,7 +1994,7 @@
}
Future<void> test_ExtensionDeclaration_extendedType2() async {
- newFile('/home/test/lib/a.dart', content: 'class A {}');
+ newFile('$testPackageLibPath/a.dart', content: 'class A {}');
addTestSource('''
import 'a.dart';
@@ -2006,7 +2006,7 @@
}
Future<void> test_ExtensionDeclaration_member() async {
- newFile('/home/test/lib/a.dart', content: 'class A {}');
+ newFile('$testPackageLibPath/a.dart', content: 'class A {}');
addTestSource('''
import 'a.dart';
@@ -2019,7 +2019,7 @@
Future<void> test_FieldDeclaration_name_typed() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {A ^}''');
@@ -2031,7 +2031,7 @@
Future<void> test_FieldDeclaration_name_var() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {var ^}''');
@@ -2043,7 +2043,7 @@
Future<void> test_FieldDeclaration_type() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {^ foo;) ''');
@@ -2056,7 +2056,7 @@
Future<void> test_FieldDeclaration_type_after_comment1() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {
@@ -2072,7 +2072,7 @@
Future<void> test_FieldDeclaration_type_after_comment2() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {
@@ -2088,7 +2088,7 @@
Future<void> test_FieldDeclaration_type_after_comment3() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {
@@ -2104,7 +2104,7 @@
Future<void> test_FieldDeclaration_type_without_semicolon() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {^ foo} ''');
@@ -2287,7 +2287,7 @@
}
Future<void> test_function_parameters_mixed_required_and_named() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int m(x, {int y}) {}
''');
addTestSource('''
@@ -2310,7 +2310,7 @@
}
Future<void> test_function_parameters_mixed_required_and_positional() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m(x, [int y]) {}
''');
addTestSource('''
@@ -2333,7 +2333,7 @@
}
Future<void> test_function_parameters_named() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m({x, int y}) {}
''');
addTestSource('''
@@ -2357,7 +2357,7 @@
Future<void> test_function_parameters_nnbd_required() async {
createAnalysisOptionsFile(experiments: [EnableString.non_nullable]);
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m(int? nullable, int nonNullable) {}
''');
addTestSource('''
@@ -2380,7 +2380,7 @@
Future<void> test_function_parameters_nnbd_required_into_legacy() async {
createAnalysisOptionsFile(experiments: [EnableString.non_nullable]);
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m(int? nullable, int nonNullable) {}
''');
addTestSource('''
@@ -2404,7 +2404,7 @@
Future<void> test_function_parameters_nnbd_required_legacy() async {
createAnalysisOptionsFile(experiments: [EnableString.non_nullable]);
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
// @dart = 2.8
void m(int param) {}
''');
@@ -2425,7 +2425,7 @@
}
Future<void> test_function_parameters_none() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m() {}
''');
addTestSource('''
@@ -2444,7 +2444,7 @@
}
Future<void> test_function_parameters_positional() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m([x, int y]) {}
''');
addTestSource('''
@@ -2467,7 +2467,7 @@
}
Future<void> test_function_parameters_required() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m(x, int y) {}
''');
addTestSource('''
@@ -2491,7 +2491,7 @@
Future<void> test_FunctionDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2522,7 +2522,7 @@
Future<void> test_FunctionDeclaration_returnType_afterComment2() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2553,7 +2553,7 @@
Future<void> test_FunctionDeclaration_returnType_afterComment3() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2600,7 +2600,7 @@
}
Future<void> test_functionTypeAlias_genericTypeAlias() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
typedef F = void Function();
''');
addTestSource(r'''
@@ -2616,7 +2616,7 @@
}
Future<void> test_functionTypeAlias_old() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
typedef void F();
''');
addTestSource(r'''
@@ -2697,7 +2697,7 @@
}
Future<void> test_implementsClause() async {
- newFile('/home/test/lib/a.dart', content: 'class A {}');
+ newFile('$testPackageLibPath/a.dart', content: 'class A {}');
addTestSource('''
import 'a.dart';
@@ -2708,7 +2708,7 @@
}
Future<void> test_implicitCreation() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
A.a1();
A.a2();
@@ -2748,7 +2748,7 @@
Future<void> test_IndexExpression() async {
// ExpressionStatement Block
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -2777,7 +2777,7 @@
Future<void> test_IndexExpression2() async {
// SimpleIdentifier IndexExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -2796,7 +2796,7 @@
}
Future<void> test_InstanceCreationExpression() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {foo(){var f; {var x;}}}
class B {B(this.x, [String boo]) { } int x;}
class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
@@ -2850,7 +2850,7 @@
}
Future<void> test_InstanceCreationExpression_abstractClass() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
abstract class A {
A();
A.generative();
@@ -2873,7 +2873,7 @@
Future<void>
test_InstanceCreationExpression_abstractClass_implicitConstructor() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
abstract class A {}
''');
addTestSource('''
@@ -2889,7 +2889,7 @@
}
Future<void> test_InstanceCreationExpression_filter() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {}
class B extends A {}
class C implements A {}
@@ -2912,7 +2912,7 @@
Future<void> test_InstanceCreationExpression_imported() async {
// SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {A(this.x) { } int x;}''');
@@ -2955,7 +2955,7 @@
Future<void> test_InstanceCreationExpression_unimported() async {
// SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
- addSource('/home/test/lib/ab.dart', 'class Clip { }');
+ addSource('$testPackageLibPath/ab.dart', 'class Clip { }');
addTestSource('class A {foo(){new C^}}');
await computeSuggestions();
@@ -2979,7 +2979,7 @@
Future<void> test_InterpolationExpression() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3013,7 +3013,7 @@
Future<void> test_InterpolationExpression_block() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3088,7 +3088,7 @@
Future<void> test_IsExpression() async {
// SimpleIdentifier NamedType IsExpression IfStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class X {X.c(); X._d(); z() {}}''');
@@ -3163,7 +3163,7 @@
// value to the type it already has.
// SimpleIdentifier NamedType IsExpression IfStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
foo() { }
class A {} class B extends A {} class C extends B {}
class X {X.c(); X._d(); z() {}}''');
@@ -3190,7 +3190,7 @@
// value to the type it already has.
// SimpleIdentifier NamedType IsExpression IfStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
foo() { }
class A {} class B implements A {} class C implements B {}
class X {X.c(); X._d(); z() {}}''');
@@ -3211,7 +3211,7 @@
}
Future<void> test_keyword() async {
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib B;
int newT1;
int T1;
@@ -3272,7 +3272,7 @@
Future<void> test_MapLiteralEntry() async {
// MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3310,7 +3310,7 @@
Future<void> test_MapLiteralEntry1() async {
// MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3337,7 +3337,7 @@
Future<void> test_MapLiteralEntry2() async {
// SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3358,7 +3358,7 @@
}
Future<void> test_method_parameters_mixed_required_and_named() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m(x, {int y}) {}
''');
addTestSource('''
@@ -3381,7 +3381,7 @@
}
Future<void> test_method_parameters_mixed_required_and_positional() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m(x, [int y]) {}
''');
addTestSource('''
@@ -3404,7 +3404,7 @@
}
Future<void> test_method_parameters_named() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m({x, int y}) {}
''');
addTestSource('''
@@ -3427,7 +3427,7 @@
}
Future<void> test_method_parameters_none() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m() {}
''');
addTestSource('''
@@ -3446,7 +3446,7 @@
}
Future<void> test_method_parameters_positional() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m([x, int y]) {}
''');
addTestSource('''
@@ -3469,7 +3469,7 @@
}
Future<void> test_method_parameters_required() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
void m(x, int y) {}
''');
addTestSource('''
@@ -3505,7 +3505,7 @@
Future<void> test_MethodDeclaration_body_static() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/c.dart', '''
+ addSource('$testPackageLibPath/c.dart', '''
class C {
c1() {}
var c2;
@@ -3591,7 +3591,7 @@
Future<void> test_MethodDeclaration_returnType() async {
// ClassDeclaration CompilationUnit
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3621,7 +3621,7 @@
Future<void> test_MethodDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3651,7 +3651,7 @@
Future<void> test_MethodDeclaration_returnType_afterComment2() async {
// MethodDeclaration ClassDeclaration CompilationUnit
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3681,7 +3681,7 @@
Future<void> test_MethodDeclaration_returnType_afterComment3() async {
// MethodDeclaration ClassDeclaration CompilationUnit
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3745,7 +3745,7 @@
}
Future<void> test_MethodTypeArgumentList() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {}
class B {}
''');
@@ -3786,7 +3786,7 @@
}
Future<void> test_mixin_ordering() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class B {}
class M1 {
void m() {}
@@ -3820,7 +3820,7 @@
}
Future<void> test_no_parameters_field() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int x;
''');
addTestSource('''
@@ -3835,7 +3835,7 @@
}
Future<void> test_no_parameters_getter() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
int get x => null;
''');
addTestSource('''
@@ -3850,7 +3850,7 @@
}
Future<void> test_no_parameters_setter() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
set x(int value) {};
''');
addTestSource('''
@@ -3910,12 +3910,12 @@
Future<void> test_partFile_TypeName2() async {
// SimpleIdentifier NamedType ConstructorName
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib libB;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
part of libA;
class B { }''');
addTestSource('''
@@ -3945,7 +3945,7 @@
Future<void> test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@@ -3992,7 +3992,7 @@
Future<void> test_PrefixedIdentifier_class_imported() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class I {X get f => new A();get _g => new A();}
class A implements I {
@@ -4071,7 +4071,7 @@
Future<void> test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@@ -4098,7 +4098,7 @@
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier NamedType
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@@ -4125,7 +4125,7 @@
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier NamedType
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@@ -4152,7 +4152,7 @@
Future<void> test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class _W {M y; var _z;}
class X extends _W {}
@@ -4171,7 +4171,7 @@
Future<void> test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
@@ -4317,7 +4317,7 @@
Future<void> test_PropertyAccess_noTarget() async {
// SimpleIdentifier PropertyAccess ExpressionStatement
- addSource('/home/test/lib/ab.dart', 'class Foo { }');
+ addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
addTestSource('class C {foo(){.^}}');
await computeSuggestions();
@@ -4326,7 +4326,7 @@
Future<void> test_PropertyAccess_noTarget2() async {
// SimpleIdentifier PropertyAccess ExpressionStatement
- addSource('/home/test/lib/ab.dart', 'class Foo { }');
+ addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
addTestSource('void f() {.^}');
await computeSuggestions();
@@ -4598,7 +4598,7 @@
Future<void> test_TopLevelVariableDeclaration_type() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
^ foo; ''');
@@ -4611,7 +4611,7 @@
Future<void> test_TopLevelVariableDeclaration_type_after_comment1() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
// comment
@@ -4625,7 +4625,7 @@
Future<void> test_TopLevelVariableDeclaration_type_after_comment2() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
/* comment */
@@ -4639,7 +4639,7 @@
Future<void> test_TopLevelVariableDeclaration_type_after_comment3() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
/// some dartdoc
@@ -4653,7 +4653,7 @@
Future<void> test_TopLevelVariableDeclaration_type_without_semicolon() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
^ foo ''');
@@ -4730,7 +4730,7 @@
Future<void> test_TypeArgumentList() async {
// SimpleIdentifier BinaryExpression ExpressionStatement
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@@ -4757,7 +4757,7 @@
Future<void> test_TypeArgumentList2() async {
// NamedType TypeArgumentList NamedType
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@@ -4795,10 +4795,10 @@
}
Future<void> test_TypeArgumentList_recursive() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {}
''');
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
export 'a.dart';
export 'b.dart';
class B {}
@@ -4817,7 +4817,7 @@
Future<void> test_VariableDeclaration_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@@ -4844,7 +4844,7 @@
Future<void> test_VariableDeclarationStatement_RHS() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@@ -4869,7 +4869,7 @@
Future<void> test_VariableDeclarationStatement_RHS_missing_semicolon() async {
// VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib B;
foo1() { }
void bar1() { }
@@ -4898,7 +4898,7 @@
}
Future<void> test_withClause_mixin() async {
- newFile('/home/test/lib/a.dart', content: 'mixin M {}');
+ newFile('$testPackageLibPath/a.dart', content: 'mixin M {}');
addTestSource('''
import 'a.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
index 646b75b..d9dc05e 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
@@ -29,7 +29,7 @@
Future<void> test_extension() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
extension MyExt on int {}
''');
addTestSource('''
@@ -134,7 +134,7 @@
Future<void> test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@@ -158,11 +158,11 @@
}
Future<void> test_PrefixedIdentifier_library_export_withShow() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
class A {}
class B {}
''');
- addSource('/home/test/lib/b.dart', r'''
+ addSource('$testPackageLibPath/b.dart', r'''
export 'a.dart' show A;
''');
addTestSource(r'''
@@ -177,7 +177,7 @@
}
Future<void> test_PrefixedIdentifier_library_import_withShow() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
class A {}
class B {}
''');
diff --git a/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
index aa2e6a2..34904db 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
@@ -45,21 +45,21 @@
Future<void> test_Block() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -186,7 +186,7 @@
Future<void> test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -201,7 +201,7 @@
Future<void> test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -216,7 +216,7 @@
Future<void> test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -231,7 +231,7 @@
Future<void> test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as Soo;
@@ -246,7 +246,7 @@
Future<void> test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -261,7 +261,7 @@
Future<void> test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -275,7 +275,7 @@
}
Future<void> test_InstanceCreationExpression() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {foo(){var f; {var x;}}}
class B {B(this.x, [String boo]) { } int x;}
class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
@@ -294,11 +294,11 @@
}
Future<void> test_InstanceCreationExpression_inPart() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {foo(){var f; {var x;}}}
class B {B(this.x, [String boo]) { } int x;}
class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
library testB;
import "a.dart" as t;
import "dart:math" as math;
@@ -313,11 +313,11 @@
}
Future<void> test_InstanceCreationExpression_inPart_detached() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {foo(){var f; {var x;}}}
class B {B(this.x, [String boo]) { } int x;}
class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
library testB;
import "a.dart" as t;
import "dart:math" as math;
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index 878fc99..804bc3a 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -81,7 +81,7 @@
Future<void> test_ArgDefaults_inherited_method_with_required_named() async {
writeTestPackageConfig(meta: true);
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
import 'package:meta/meta.dart';
lib libB;
@@ -120,7 +120,7 @@
Future<void> test_ArgumentList() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@@ -145,7 +145,7 @@
Future<void> test_ArgumentList_imported_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(arg) { }
@@ -172,7 +172,7 @@
Future<void>
test_ArgumentList_InstanceCreationExpression_functionalArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@@ -201,7 +201,7 @@
Future<void> test_ArgumentList_InstanceCreationExpression_typedefArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
typedef Funct();
class A { A(Funct f) { } }
@@ -231,7 +231,7 @@
Future<void> test_ArgumentList_local_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@@ -257,7 +257,7 @@
Future<void> test_ArgumentList_local_method() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@@ -283,7 +283,7 @@
Future<void> test_ArgumentList_MethodInvocation_functionalArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@@ -314,7 +314,7 @@
Future<void> test_ArgumentList_MethodInvocation_functionalArg2() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@@ -350,7 +350,7 @@
Future<void> test_ArgumentList_MethodInvocation_methodArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@@ -375,7 +375,7 @@
}
Future<void> test_ArgumentList_namedFieldParam_tear_off() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
typedef void VoidCallback();
class Button {
@@ -406,7 +406,7 @@
Future<void> test_ArgumentList_namedParam() async {
// SimpleIdentifier NamedExpression ArgumentList MethodInvocation
// ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }''');
addTestSource('''
@@ -452,7 +452,7 @@
}
Future<void> test_ArgumentList_namedParam_tear_off() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
typedef void VoidCallback();
class Button {
@@ -480,7 +480,7 @@
}
Future<void> test_ArgumentList_namedParam_tear_off_1() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
typedef void VoidCallback();
class Button {
@@ -508,7 +508,7 @@
}
Future<void> test_ArgumentList_namedParam_tear_off_2() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
typedef void VoidCallback();
class Button {
@@ -755,7 +755,7 @@
Future<void> test_AwaitExpression_inherited() async {
// SimpleIdentifier AwaitExpression ExpressionStatement
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib libB;
class A {
Future y() async {return 0;}
@@ -812,21 +812,21 @@
Future<void> test_Block() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -905,21 +905,21 @@
Future<void> test_Block_final() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -1018,21 +1018,21 @@
Future<void> test_Block_final_final() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -1117,21 +1117,21 @@
Future<void> test_Block_final_var() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -1215,21 +1215,21 @@
}
Future<void> test_Block_identifier_partial() async {
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B { }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
class D3 { }
int T3;
@@ -1294,7 +1294,7 @@
Future<void> test_Block_inherited_imported() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
@@ -1322,7 +1322,7 @@
Future<void> test_Block_inherited_imported_from_constructor() async {
// Block BlockFunctionBody ConstructorDeclaration ClassDeclaration
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
@@ -1349,7 +1349,7 @@
Future<void> test_Block_inherited_imported_from_method() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
@@ -1448,21 +1448,21 @@
}
Future<void> test_Block_local_function() async {
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
- addSource('/home/test/lib/eef.dart', '''
+ addSource('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
- addSource('/home/test/lib/g.dart', 'class G { }');
- addSource('/home/test/lib/h.dart', '''
+ addSource('$testPackageLibPath/g.dart', 'class G { }');
+ addSource('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@@ -1526,7 +1526,7 @@
Future<void> test_CascadeExpression_selector1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@@ -1551,7 +1551,7 @@
Future<void> test_CascadeExpression_selector2() async {
// SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@@ -1574,7 +1574,7 @@
Future<void> test_CascadeExpression_selector2_withTrailingReturn() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@@ -1680,7 +1680,7 @@
Future<void> test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1709,7 +1709,7 @@
Future<void> test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1730,7 +1730,7 @@
Future<void> test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1751,7 +1751,7 @@
Future<void> test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as Soo;
@@ -1772,7 +1772,7 @@
Future<void> test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1793,7 +1793,7 @@
Future<void> test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1839,7 +1839,7 @@
Future<void> test_Combinator_hide() async {
// SimpleIdentifier HideCombinator ImportDirective
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
library libAB;
part 'partAB.dart';
class A { }
@@ -1849,7 +1849,7 @@
var T1;
PB F1() => new PB();
class PB { }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@@ -1863,7 +1863,7 @@
Future<void> test_Combinator_show() async {
// SimpleIdentifier HideCombinator ImportDirective
- addSource('/home/test/lib/ab.dart', '''
+ addSource('$testPackageLibPath/ab.dart', '''
library libAB;
part 'partAB.dart';
class A { }
@@ -1875,7 +1875,7 @@
typedef PB2 F2(int blat);
class Clz = Object with Object;
class PB { }''');
- addSource('/home/test/lib/cd.dart', '''
+ addSource('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@@ -1889,7 +1889,7 @@
Future<void> test_ConditionalExpression_elseExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1909,7 +1909,7 @@
Future<void> test_ConditionalExpression_elseExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1935,7 +1935,7 @@
Future<void> test_ConditionalExpression_partial_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1955,7 +1955,7 @@
Future<void> test_ConditionalExpression_partial_thenExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1981,7 +1981,7 @@
Future<void> test_ConditionalExpression_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -2068,7 +2068,7 @@
Future<void> test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@@ -2093,7 +2093,7 @@
Future<void> test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@@ -2572,7 +2572,7 @@
Future<void> test_ExpressionStatement_identifier() async {
// SimpleIdentifier ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
_B F1() { }
class A {int x;}
class _B { }''');
@@ -2600,7 +2600,7 @@
Future<void> test_ExpressionStatement_name() async {
// ExpressionStatement Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
B T1;
class B{}''');
addTestSource('''
@@ -2670,7 +2670,7 @@
Future<void> test_extensionDeclaration_notInBody() async {
// ExtensionDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -2723,7 +2723,7 @@
Future<void> test_FieldDeclaration_name_typed() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import "a.dart";
class C {A ^}''');
@@ -2735,7 +2735,7 @@
Future<void> test_FieldDeclaration_name_var() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import "a.dart";
class C {var ^}''');
@@ -3232,7 +3232,7 @@
Future<void> test_FunctionDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3263,7 +3263,7 @@
Future<void> test_FunctionDeclaration_returnType_afterComment2() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3294,7 +3294,7 @@
Future<void> test_FunctionDeclaration_returnType_afterComment3() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3560,7 +3560,7 @@
Future<void> test_IndexExpression() async {
// ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -3586,7 +3586,7 @@
Future<void> test_IndexExpression2() async {
// SimpleIdentifier IndexExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -3611,7 +3611,7 @@
}
Future<void> test_inherited() async {
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib libB;
class A2 {
int x;
@@ -3763,7 +3763,7 @@
Future<void> test_InstanceCreationExpression_imported() async {
// SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {A(this.x) { } int x;}''');
@@ -3865,7 +3865,7 @@
Future<void> test_InterpolationExpression_block() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3938,7 +3938,7 @@
Future<void> test_IsExpression() async {
// SimpleIdentifier NamedType IsExpression IfStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class X {X.c(); X._d(); z() {}}''');
@@ -4061,7 +4061,7 @@
}
Future<void> test_keyword() async {
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int newT1;
int T1;
@@ -4214,7 +4214,7 @@
Future<void> test_MapLiteralEntry() async {
// MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -4244,7 +4244,7 @@
Future<void> test_MapLiteralEntry1() async {
// MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -4266,7 +4266,7 @@
Future<void> test_MapLiteralEntry2() async {
// SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -4322,7 +4322,7 @@
}
Future<void> test_method_parameters_mixed_required_and_named() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {
void m(x, {int y}) {}
}
@@ -4369,7 +4369,7 @@
}
Future<void> test_method_parameters_mixed_required_and_positional() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {
void m(x, [int y]) {}
}
@@ -4417,7 +4417,7 @@
}
Future<void> test_method_parameters_named() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {
void m({x, int y}) {}
}
@@ -4464,7 +4464,7 @@
}
Future<void> test_method_parameters_none() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {
void m() {}
}
@@ -4501,7 +4501,7 @@
}
Future<void> test_method_parameters_positional() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {
void m([x, int y]) {}
}
@@ -4548,7 +4548,7 @@
}
Future<void> test_method_parameters_required() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {
void m(x, int y) {}
}
@@ -4607,7 +4607,7 @@
Future<void> test_MethodDeclaration_body_static() async {
// Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/c.dart', '''
+ addSource('$testPackageLibPath/c.dart', '''
class C {
c1() {}
var c2;
@@ -4784,7 +4784,7 @@
Future<void> test_MethodDeclaration_returnType() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -4814,7 +4814,7 @@
Future<void> test_MethodDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -4844,7 +4844,7 @@
Future<void> test_MethodDeclaration_returnType_afterComment2() async {
// MethodDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -4874,7 +4874,7 @@
Future<void> test_MethodDeclaration_returnType_afterComment3() async {
// MethodDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -5008,7 +5008,7 @@
}
Future<void> test_mixin_ordering() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class B {}
class M1 {
void m() {}
@@ -5031,7 +5031,7 @@
Future<void> test_MixinDeclaration_body() async {
// MixinDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -5115,7 +5115,7 @@
}
Future<void> test_no_parameters_field() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {
int x;
}
@@ -5132,7 +5132,7 @@
}
Future<void> test_no_parameters_getter() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {
int get x => null;
}
@@ -5149,7 +5149,7 @@
}
Future<void> test_no_parameters_setter() async {
- resolveSource('/home/test/lib/a.dart', '''
+ resolveSource('$testPackageLibPath/a.dart', '''
class A {
set x(int value) {};
}
@@ -5166,7 +5166,7 @@
}
Future<void> test_outside_class() async {
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib libB;
class A2 {
int x;
@@ -5253,7 +5253,7 @@
Future<void> test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@@ -5300,7 +5300,7 @@
Future<void> test_PrefixedIdentifier_class_imported() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class I {X get f => new A();get _g => new A();}
class A implements I {
@@ -5379,7 +5379,7 @@
Future<void> test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@@ -5406,7 +5406,7 @@
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier NamedType
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@@ -5433,7 +5433,7 @@
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier NamedType
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@@ -5460,7 +5460,7 @@
Future<void> test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class _W {M y; var _z;}
class X extends _W {}
@@ -5479,7 +5479,7 @@
Future<void> test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
@@ -5643,7 +5643,7 @@
Future<void> test_PropertyAccess_noTarget() async {
// SimpleIdentifier PropertyAccess ExpressionStatement
- addSource('/home/test/lib/ab.dart', 'class Foo { }');
+ addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
addTestSource('class C {foo(){.^}}');
await computeSuggestions();
@@ -5652,7 +5652,7 @@
Future<void> test_PropertyAccess_noTarget2() async {
// SimpleIdentifier PropertyAccess ExpressionStatement
- addSource('/home/test/lib/ab.dart', 'class Foo { }');
+ addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
addTestSource('void f() {.^}');
await computeSuggestions();
@@ -5680,7 +5680,7 @@
}
Future<void> test_static_field() async {
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib libB;
class A2 {
int x;
@@ -5722,7 +5722,7 @@
}
Future<void> test_static_method() async {
- resolveSource('/home/test/lib/b.dart', '''
+ resolveSource('$testPackageLibPath/b.dart', '''
lib libB;
class A2 {
int x;
@@ -6107,7 +6107,7 @@
Future<void> test_TypeArgumentList() async {
// SimpleIdentifier BinaryExpression ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@@ -6134,7 +6134,7 @@
Future<void> test_TypeArgumentList2() async {
// NamedType TypeArgumentList NamedType
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@@ -6198,7 +6198,7 @@
Future<void> test_VariableDeclaration_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@@ -6225,7 +6225,7 @@
Future<void> test_VariableDeclarationStatement_RHS() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@@ -6250,7 +6250,7 @@
Future<void> test_VariableDeclarationStatement_RHS_missing_semicolon() async {
// VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo1() { }
void bar1() { }
diff --git a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
index c522a1f..7c9b3d8 100644
--- a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
@@ -292,7 +292,7 @@
Future<void> test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@@ -320,7 +320,7 @@
Future<void> test_ConstructorName_importedClass_unresolved() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@@ -349,7 +349,7 @@
Future<void> test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@@ -450,7 +450,7 @@
Future<void>
test_importPrefix_className_typeArguments_period_nothing_functionTypeContext_matchingReturnType() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A<T> {
A.named();
A.new();
diff --git a/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
index e8eff71..0e65414 100644
--- a/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
@@ -153,7 +153,7 @@
}
Future<void> test_fromPart() async {
- addSource('/home/test/lib/myLib.dart', '''
+ addSource('$testPackageLibPath/myLib.dart', '''
library myLib;
part 'test.dart';
part 'otherPart.dart';
@@ -162,7 +162,7 @@
B suggested2(String y) => null;
}
''');
- addSource('/home/test/lib/otherPart.dart', '''
+ addSource('$testPackageLibPath/otherPart.dart', '''
part of myLib;
class B extends A {
B suggested2(String y) => null;
diff --git a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
index e4bc0d3..7c2a610 100644
--- a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_class_static_notPrivate() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
static int _f;
static String get _g => '';
@@ -138,7 +138,7 @@
}
Future<void> test_extension_static_notPrivate() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
extension E {
static int _f;
static String get _g => '';
@@ -160,7 +160,7 @@
}
Future<void> test_implicitCreation() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
A.foo();
A.bar();
@@ -181,7 +181,7 @@
Future<void>
test_implicitCreation_functionContextType_matchingReturnType() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
A.foo();
A.bar();
@@ -202,7 +202,7 @@
Future<void>
test_implicitCreation_functionContextType_notMatchingReturnType() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
A.foo();
A.bar();
@@ -365,7 +365,7 @@
Future<void> test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@@ -409,7 +409,7 @@
}
Future<void> test_simpleIdentifier_typeAlias_interfaceType_class() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
static int _privateField = 0;
static int get _privateGetter => 0;
@@ -451,7 +451,7 @@
}
Future<void> test_simpleIdentifier_typeAlias_interfaceType_enum() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
enum E {
aaa,
_bbb,
diff --git a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
index fb04e96..47000b2 100644
--- a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
@@ -114,7 +114,7 @@
Future<void> test_ArgumentList() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@@ -138,7 +138,7 @@
Future<void> test_ArgumentList_imported_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(arg) { }
@@ -164,7 +164,7 @@
Future<void>
test_ArgumentList_InstanceCreationExpression_functionalArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@@ -191,7 +191,7 @@
Future<void> test_ArgumentList_InstanceCreationExpression_typedefArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
typedef Funct();
class A { A(Funct f) { } }
@@ -219,7 +219,7 @@
Future<void> test_ArgumentList_local_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@@ -244,7 +244,7 @@
Future<void> test_ArgumentList_local_method() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@@ -269,7 +269,7 @@
Future<void> test_ArgumentList_MethodInvocation_functionalArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@@ -296,7 +296,7 @@
Future<void> test_ArgumentList_MethodInvocation_methodArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@@ -322,7 +322,7 @@
Future<void> test_ArgumentList_namedParam() async {
// SimpleIdentifier NamedExpression ArgumentList MethodInvocation
// ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }''');
addTestSource('''
@@ -977,7 +977,7 @@
Future<void> test_Block_inherited_imported() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
@@ -1093,7 +1093,7 @@
Future<void> test_CascadeExpression_method1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@@ -1117,7 +1117,7 @@
Future<void> test_CascadeExpression_selector1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@@ -1141,7 +1141,7 @@
Future<void> test_CascadeExpression_selector2() async {
// SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@@ -1163,7 +1163,7 @@
Future<void> test_CascadeExpression_selector2_withTrailingReturn() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@@ -1252,7 +1252,7 @@
Future<void> test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1271,7 +1271,7 @@
Future<void> test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1290,7 +1290,7 @@
Future<void> test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1309,7 +1309,7 @@
Future<void> test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as Soo;
@@ -1328,7 +1328,7 @@
Future<void> test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1347,7 +1347,7 @@
Future<void> test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@@ -1414,7 +1414,7 @@
Future<void> test_ConditionalExpression_elseExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1433,7 +1433,7 @@
Future<void> test_ConditionalExpression_elseExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1458,7 +1458,7 @@
Future<void> test_ConditionalExpression_partial_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1477,7 +1477,7 @@
Future<void> test_ConditionalExpression_partial_thenExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1502,7 +1502,7 @@
Future<void> test_ConditionalExpression_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -1522,7 +1522,7 @@
Future<void> test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@@ -1546,7 +1546,7 @@
Future<void> test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@@ -1706,7 +1706,7 @@
Future<void> test_ExpressionStatement_identifier() async {
// SimpleIdentifier ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
_B F1() { }
class A {int x;}
class _B { }''');
@@ -1732,7 +1732,7 @@
Future<void> test_ExpressionStatement_name() async {
// ExpressionStatement Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
B T1;
class B{}''');
addTestSource('''
@@ -1759,7 +1759,7 @@
Future<void> test_FieldDeclaration_name_typed() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import "a.dart";
class C {A ^}''');
@@ -1770,7 +1770,7 @@
Future<void> test_FieldDeclaration_name_var() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import "a.dart";
class C {var ^}''');
@@ -1922,7 +1922,7 @@
Future<void> test_FunctionDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -1951,7 +1951,7 @@
Future<void> test_FunctionDeclaration_returnType_afterComment2() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -1980,7 +1980,7 @@
Future<void> test_FunctionDeclaration_returnType_afterComment3() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2174,7 +2174,7 @@
Future<void> test_IndexExpression() async {
// ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -2199,7 +2199,7 @@
Future<void> test_IndexExpression2() async {
// SimpleIdentifier IndexExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@@ -2218,7 +2218,7 @@
Future<void> test_InstanceCreationExpression_imported() async {
// SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {A(this.x) { } int x;}''');
@@ -2304,7 +2304,7 @@
Future<void> test_InterpolationExpression() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2333,7 +2333,7 @@
Future<void> test_InterpolationExpression_block() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2399,7 +2399,7 @@
Future<void> test_IsExpression() async {
// SimpleIdentifier NamedType IsExpression IfStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class X {X.c(); X._d(); z() {}}''');
@@ -2472,7 +2472,7 @@
}
Future<void> test_keyword2() async {
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int newT1;
int T1;
@@ -2532,8 +2532,8 @@
}
Future<void> test_libraryPrefix_with_exports() async {
- addSource('/home/test/lib/a.dart', 'class A { }');
- addSource('/home/test/lib/b.dart', 'export "a.dart"; class B { }');
+ addSource('$testPackageLibPath/a.dart', 'class A { }');
+ addSource('$testPackageLibPath/b.dart', 'export "a.dart"; class B { }');
addTestSource('import "b.dart" as foo; void f() {foo.^} class C { }');
await computeSuggestions();
// Suggested by LibraryMemberContributor
@@ -2591,7 +2591,7 @@
Future<void> test_MapLiteralEntry() async {
// MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2618,7 +2618,7 @@
Future<void> test_MapLiteralEntry1() async {
// MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2638,7 +2638,7 @@
Future<void> test_MapLiteralEntry2() async {
// SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2937,7 +2937,7 @@
Future<void> test_MethodDeclaration_returnType() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2965,7 +2965,7 @@
Future<void> test_MethodDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -2993,7 +2993,7 @@
Future<void> test_MethodDeclaration_returnType_afterComment2() async {
// MethodDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3021,7 +3021,7 @@
Future<void> test_MethodDeclaration_returnType_afterComment3() async {
// MethodDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@@ -3268,12 +3268,12 @@
Future<void> test_partFile_TypeName() async {
// SimpleIdentifier NamedType ConstructorName
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library libA;
import "b.dart";
part "${resourceProvider.pathContext.basename(testFile)}";
@@ -3300,12 +3300,12 @@
Future<void> test_partFile_TypeName2() async {
// SimpleIdentifier NamedType ConstructorName
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
part of libA;
class B { }''');
addTestSource('''
@@ -3332,7 +3332,7 @@
Future<void> test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@@ -3378,7 +3378,7 @@
Future<void> test_PrefixedIdentifier_class_imported() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class I {X get f => new A();get _g => new A();}
class A implements I {
@@ -3454,7 +3454,7 @@
Future<void> test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@@ -3480,7 +3480,7 @@
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier NamedType
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@@ -3506,7 +3506,7 @@
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier NamedType
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@@ -3532,7 +3532,7 @@
Future<void> test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
class _W {M y; var _z;}
class X extends _W {}
@@ -3550,7 +3550,7 @@
Future<void> test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
@@ -4149,7 +4149,7 @@
Future<void> test_TypeArgumentList() async {
// SimpleIdentifier BinaryExpression ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@@ -4174,7 +4174,7 @@
Future<void> test_TypeArgumentList2() async {
// NamedType TypeArgumentList NamedType
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@@ -4218,7 +4218,7 @@
Future<void> test_VariableDeclaration_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@@ -4243,7 +4243,7 @@
Future<void> test_VariableDeclarationStatement_RHS() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@@ -4267,7 +4267,7 @@
Future<void> test_VariableDeclarationStatement_RHS_missing_semicolon() async {
// VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
lib B;
foo1() { }
void bar1() { }
diff --git a/pkg/analysis_server/test/services/completion/postfix/postfix_completion_test.dart b/pkg/analysis_server/test/services/completion/postfix/postfix_completion_test.dart
index 5e73ef0..dfc309c 100644
--- a/pkg/analysis_server/test/services/completion/postfix/postfix_completion_test.dart
+++ b/pkg/analysis_server/test/services/completion/postfix/postfix_completion_test.dart
@@ -738,7 +738,7 @@
}
Future<void> test_tryonThrowStatement_nnbd_into_legacy() async {
- newFile('/home/test/lib/a.dart', content: r'''
+ newFile('$testPackageLibPath/a.dart', content: r'''
String? x;
''');
await _prepareCompletion('.tryon', '''
@@ -762,7 +762,7 @@
}
Future<void> test_tryonThrowStatement_nnbd_into_legacy_nested() async {
- newFile('/home/test/lib/a.dart', content: r'''
+ newFile('$testPackageLibPath/a.dart', content: r'''
List<String?> x;
''');
await _prepareCompletion('.tryon', '''
@@ -786,7 +786,7 @@
}
Future<void> test_tryonThrowStatement_nnbd_legacy() async {
- newFile('/home/test/lib/a.dart', content: r'''
+ newFile('$testPackageLibPath/a.dart', content: r'''
// @dart = 2.8
String x;
''');
@@ -809,7 +809,7 @@
}
Future<void> test_tryonThrowStatement_nnbd_legacy_nested() async {
- newFile('/home/test/lib/a.dart', content: r'''
+ newFile('$testPackageLibPath/a.dart', content: r'''
// @dart = 2.8
List<String> x;
''');
diff --git a/pkg/analysis_server/test/services/correction/organize_directives_test.dart b/pkg/analysis_server/test/services/correction/organize_directives_test.dart
index 160c31d..8ecae36 100644
--- a/pkg/analysis_server/test/services/correction/organize_directives_test.dart
+++ b/pkg/analysis_server/test/services/correction/organize_directives_test.dart
@@ -881,7 +881,7 @@
}
Future<void> _addAnnotationsFile() async {
- final annotationsFile = convertPath('/home/test/lib/annotations.dart');
+ final annotationsFile = convertPath('$testPackageLibPath/annotations.dart');
const annotationsContent = '''
import 'package:meta/meta_meta.dart';
diff --git a/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart b/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart
index b8cc8eb..8b090db 100644
--- a/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart
@@ -89,7 +89,7 @@
}
Future<void> test_change_multipleFiles() async {
- await indexUnit('/home/test/lib/other.dart', r'''
+ await indexUnit('$testPackageLibPath/other.dart', r'''
class A {
int get test => 1;
}
diff --git a/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart b/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart
index c95f9e0..58aea84 100644
--- a/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart
@@ -88,7 +88,7 @@
}
Future<void> test_change_multipleFiles() async {
- await indexUnit('/home/test/lib/other.dart', r'''
+ await indexUnit('$testPackageLibPath/other.dart', r'''
class A {
int test() => 1;
}
diff --git a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
index 527b60f..98584b89 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
@@ -2871,7 +2871,7 @@
}
void _addLibraryReturningAsync() {
- addSource('/home/test/lib/asyncLib.dart', r'''
+ addSource('$testPackageLibPath/asyncLib.dart', r'''
import 'dart:async';
Completer<int> newCompleter() => null;
diff --git a/pkg/analysis_server/test/services/refactoring/move_file_test.dart b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
index 5094b24..52fe0df 100644
--- a/pkg/analysis_server/test/services/refactoring/move_file_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
@@ -57,7 +57,7 @@
}
Future<void> test_file_imported_with_package_uri_down() async {
- var file = newFile('/home/test/lib/old_name.dart', content: '');
+ var file = newFile('$testPackageLibPath/old_name.dart', content: '');
addTestSource(r'''
import 'package:test/old_name.dart';
''');
@@ -69,7 +69,8 @@
testAnalysisResult =
await session.getResolvedUnit(file.path) as ResolvedUnitResult;
- _createRefactoring('/home/test/lib/222/new_name.dart', oldFile: file.path);
+ _createRefactoring('$testPackageLibPath/222/new_name.dart',
+ oldFile: file.path);
await _assertSuccessfulRefactoring();
assertFileChangeResult(testFile, '''
@@ -150,7 +151,7 @@
}
Future<void> test_file_imported_with_package_uri_sideways() async {
- var file = newFile('/home/test/lib/111/old_name.dart', content: '');
+ var file = newFile('$testPackageLibPath/111/old_name.dart', content: '');
addTestSource(r'''
import 'package:test/111/old_name.dart';
''');
@@ -162,7 +163,8 @@
testAnalysisResult =
await session.getResolvedUnit(file.path) as ResolvedUnitResult;
- _createRefactoring('/home/test/lib/222/new_name.dart', oldFile: file.path);
+ _createRefactoring('$testPackageLibPath/222/new_name.dart',
+ oldFile: file.path);
await _assertSuccessfulRefactoring();
assertFileChangeResult(testFile, '''
@@ -171,7 +173,7 @@
}
Future<void> test_file_imported_with_package_uri_up() async {
- var file = newFile('/home/test/lib/222/old_name.dart', content: '');
+ var file = newFile('$testPackageLibPath/222/old_name.dart', content: '');
addTestSource(r'''
import 'package:test/222/old_name.dart';
''');
@@ -183,7 +185,7 @@
testAnalysisResult =
await session.getResolvedUnit(file.path) as ResolvedUnitResult;
- _createRefactoring('/home/test/lib/new_name.dart', oldFile: file.path);
+ _createRefactoring('$testPackageLibPath/new_name.dart', oldFile: file.path);
await _assertSuccessfulRefactoring();
assertFileChangeResult(testFile, '''
diff --git a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
index 872fe9d..af8c5b5 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
@@ -157,7 +157,7 @@
test() {}
}
''');
- await indexUnit('/home/test/lib/lib.dart', '''
+ await indexUnit('$testPackageLibPath/lib.dart', '''
library my.lib;
import 'test.dart';
@@ -181,7 +181,7 @@
var foo = 1;
}
''');
- await indexUnit('/home/test/lib/lib.dart', '''
+ await indexUnit('$testPackageLibPath/lib.dart', '''
import 'test.dart';
void f(A a) {
@@ -387,7 +387,7 @@
newName() {} // marker
}
''';
- await indexUnit('/home/test/lib/lib.dart', libCode);
+ await indexUnit('$testPackageLibPath/lib.dart', libCode);
await indexTestUnit('''
import 'lib.dart';
class B extends A {
diff --git a/pkg/analysis_server/test/services/refactoring/rename_library_test.dart b/pkg/analysis_server/test/services/refactoring/rename_library_test.dart
index 2f37e06..0b6b03c 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_library_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_library_test.dart
@@ -35,7 +35,7 @@
}
Future<void> test_createChange() async {
- addSource('/home/test/lib/part.dart', '''
+ addSource('$testPackageLibPath/part.dart', '''
part of my.app;
''');
await indexTestUnit('''
@@ -52,13 +52,13 @@
library the.new.name;
part 'part.dart';
''');
- assertFileChangeResult('/home/test/lib/part.dart', '''
+ assertFileChangeResult('$testPackageLibPath/part.dart', '''
part of the.new.name;
''');
}
Future<void> test_createChange_hasWhitespaces() async {
- addSource('/home/test/lib/part.dart', '''
+ addSource('$testPackageLibPath/part.dart', '''
part of my . app;
''');
await indexTestUnit('''
@@ -75,7 +75,7 @@
library the.new.name;
part 'part.dart';
''');
- assertFileChangeResult('/home/test/lib/part.dart', '''
+ assertFileChangeResult('$testPackageLibPath/part.dart', '''
part of the.new.name;
''');
}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
index 5c43032..5b42916 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
@@ -442,9 +442,38 @@
''');
}
+ Future<void> test_createChange_parameter_named_anywhere() async {
+ await indexTestUnit('''
+myFunction(int a, int b, {required int test}) {
+ test = 1;
+ test += 2;
+ print(test);
+}
+void f() {
+ myFunction(0, test: 2, 1);
+}
+''');
+ // configure refactoring
+ createRenameRefactoringAtString('test}) {');
+ expect(refactoring.refactoringName, 'Rename Parameter');
+ expect(refactoring.elementKindName, 'parameter');
+ refactoring.newName = 'newName';
+ // validate change
+ return assertSuccessfulRefactoring('''
+myFunction(int a, int b, {required int newName}) {
+ newName = 1;
+ newName += 2;
+ print(newName);
+}
+void f() {
+ myFunction(0, newName: 2, 1);
+}
+''');
+ }
+
Future<void> test_createChange_parameter_named_inOtherFile() async {
- var a = convertPath('/home/test/lib/a.dart');
- var b = convertPath('/home/test/lib/b.dart');
+ var a = convertPath('$testPackageLibPath/a.dart');
+ var b = convertPath('$testPackageLibPath/b.dart');
newFile(a, content: r'''
class A {
@@ -537,7 +566,7 @@
}
Future<void> test_createChange_parameter_named_updateHierarchy() async {
- await indexUnit('/home/test/lib/test2.dart', '''
+ await indexUnit('$testPackageLibPath/test2.dart', '''
library test2;
class A {
void foo({int? test}) {
@@ -581,7 +610,7 @@
}
}
''');
- assertFileChangeResult('/home/test/lib/test2.dart', '''
+ assertFileChangeResult('$testPackageLibPath/test2.dart', '''
library test2;
class A {
void foo({int? newName}) {
diff --git a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
index a65f922..e0ebb09 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
@@ -71,7 +71,7 @@
await indexTestUnit('''
class Test {}
''');
- await indexUnit('/home/test/lib/lib.dart', '''
+ await indexUnit('$testPackageLibPath/lib.dart', '''
library my.lib;
import 'test.dart';
@@ -112,7 +112,7 @@
await indexTestUnit('''
class Test {}
''');
- await indexUnit('/home/test/lib/lib.dart', '''
+ await indexUnit('$testPackageLibPath/lib.dart', '''
library my.lib;
import 'test.dart';
class A {
@@ -610,7 +610,7 @@
}
Future<void> test_createChange_FunctionElement_imported() async {
- await indexUnit('/home/test/lib/foo.dart', r'''
+ await indexUnit('$testPackageLibPath/foo.dart', r'''
test() {}
foo() {}
''');
@@ -637,7 +637,7 @@
foo();
}
''');
- assertFileChangeResult('/home/test/lib/foo.dart', '''
+ assertFileChangeResult('$testPackageLibPath/foo.dart', '''
newName() {}
foo() {}
''');
diff --git a/pkg/analysis_server/test/src/computer/closing_labels_computer_test.dart b/pkg/analysis_server/test/src/computer/closing_labels_computer_test.dart
index 83a9954..3c99d77 100644
--- a/pkg/analysis_server/test/src/computer/closing_labels_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/closing_labels_computer_test.dart
@@ -23,7 +23,7 @@
@override
void setUp() {
super.setUp();
- sourcePath = convertPath('/home/test/lib/test.dart');
+ sourcePath = convertPath('$testPackageLibPath/test.dart');
}
Future<void> test_adjacentLinesExcluded() async {
diff --git a/pkg/analysis_server/test/src/computer/color_computer_test.dart b/pkg/analysis_server/test/src/computer/color_computer_test.dart
index 190f0d9..1178812 100644
--- a/pkg/analysis_server/test/src/computer/color_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/color_computer_test.dart
@@ -192,8 +192,8 @@
void setUp() {
super.setUp();
writeTestPackageConfig(flutter: true);
- testPath = convertPath('/home/test/lib/test.dart');
- otherPath = convertPath('/home/test/lib/other_file.dart');
+ testPath = convertPath('$testPackageLibPath/test.dart');
+ otherPath = convertPath('$testPackageLibPath/other_file.dart');
}
Future<void> test_collectionLiteral_const() async {
diff --git a/pkg/analysis_server/test/src/computer/folding_computer_test.dart b/pkg/analysis_server/test/src/computer/folding_computer_test.dart
index f63607d..bba4d0b 100644
--- a/pkg/analysis_server/test/src/computer/folding_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/folding_computer_test.dart
@@ -29,7 +29,7 @@
@override
void setUp() {
super.setUp();
- sourcePath = convertPath('/home/test/lib/test.dart');
+ sourcePath = convertPath('$testPackageLibPath/test.dart');
}
Future<void> test_annotations() async {
diff --git a/pkg/analysis_server/test/src/computer/highlights_computer_test.dart b/pkg/analysis_server/test/src/computer/highlights_computer_test.dart
index 46a6c44..d1a90d3 100644
--- a/pkg/analysis_server/test/src/computer/highlights_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/highlights_computer_test.dart
@@ -25,7 +25,7 @@
@override
void setUp() {
super.setUp();
- sourcePath = convertPath('/home/test/lib/test.dart');
+ sourcePath = convertPath('$testPackageLibPath/test.dart');
}
Future<void> test_comment() async {
diff --git a/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart b/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
index fed52b7..133ab24 100644
--- a/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
@@ -57,7 +57,7 @@
@override
void setUp() {
super.setUp();
- path = convertPath('/home/test/lib/test.dart');
+ path = convertPath('$testPackageLibPath/test.dart');
}
Future<void> test_createEdits_addImport_noDirectives() async {
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 a63d9bc..cf1cf9a 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
@@ -46,7 +46,7 @@
@override
void setUp() {
super.setUp();
- sourcePath = convertPath('/home/test/lib/test.dart');
+ sourcePath = convertPath('$testPackageLibPath/test.dart');
}
Future<void> test_dartAsync_noPrefix() async {
diff --git a/pkg/analysis_server/test/src/computer/outline_computer_test.dart b/pkg/analysis_server/test/src/computer/outline_computer_test.dart
index 185338f..7a0837e 100644
--- a/pkg/analysis_server/test/src/computer/outline_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/outline_computer_test.dart
@@ -24,7 +24,7 @@
@override
void setUp() {
super.setUp();
- testPath = convertPath('/home/test/lib/test.dart');
+ testPath = convertPath('$testPackageLibPath/test.dart');
}
Future<Outline> _computeOutline(String code) async {
diff --git a/pkg/analysis_server/test/src/computer/selection_range_computer_test.dart b/pkg/analysis_server/test/src/computer/selection_range_computer_test.dart
index 27e9e7f..ee07e86 100644
--- a/pkg/analysis_server/test/src/computer/selection_range_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/selection_range_computer_test.dart
@@ -22,7 +22,7 @@
@override
void setUp() {
super.setUp();
- sourcePath = convertPath('/home/test/lib/test.dart');
+ sourcePath = convertPath('$testPackageLibPath/test.dart');
}
Future<void> test_arguments() async {
diff --git a/pkg/analysis_server/test/src/domains/execution/completion_test.dart b/pkg/analysis_server/test/src/domains/execution/completion_test.dart
index 81d2594..4f3af62 100644
--- a/pkg/analysis_server/test/src/domains/execution/completion_test.dart
+++ b/pkg/analysis_server/test/src/domains/execution/completion_test.dart
@@ -25,7 +25,7 @@
late RuntimeCompletionResult result;
void addContextFile(String content) {
- contextFile = convertPath('/home/test/lib/context.dart');
+ contextFile = convertPath('$testPackageLibPath/context.dart');
addSource(contextFile, content);
contextOffset = content.indexOf('// context line');
@@ -120,13 +120,13 @@
@FailingTest(reason: 'No support for OverlayResourceProvider')
Future<void> test_inPart() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
part 'b.dart';
part 'context.dart';
int a;
''');
- addSource('/home/test/lib/b.dart', r'''
+ addSource('$testPackageLibPath/b.dart', r'''
part of 'a.dart';
double b;
diff --git a/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart b/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
index c224c12..e55c554 100644
--- a/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
+++ b/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
@@ -27,7 +27,7 @@
void setUp() {
super.setUp();
writeTestPackageConfig(flutter: true);
- testPath = convertPath('/home/test/lib/test.dart');
+ testPath = convertPath('$testPackageLibPath/test.dart');
}
Future<void> test_attribute_namedExpression() async {
@@ -234,7 +234,7 @@
}
Future<void> test_children_closure_blockBody() async {
- newFile('/home/test/lib/a.dart', content: r'''
+ newFile('$testPackageLibPath/a.dart', content: r'''
import 'package:flutter/widgets.dart';
class WidgetA extends StatelessWidget {
@@ -270,7 +270,7 @@
}
Future<void> test_children_closure_expressionBody() async {
- newFile('/home/test/lib/a.dart', content: r'''
+ newFile('$testPackageLibPath/a.dart', content: r'''
import 'package:flutter/widgets.dart';
class WidgetA extends StatelessWidget {
@@ -443,7 +443,7 @@
}
Future<void> test_parentAssociationLabel() async {
- newFile('/home/test/lib/a.dart', content: r'''
+ newFile('$testPackageLibPath/a.dart', content: r'''
import 'package:flutter/widgets.dart';
class WidgetA extends StatelessWidget {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
index a12a654..c9d3b7f 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
@@ -84,7 +84,7 @@
}
Future<void> test_declaredIdentifier_addImport_dartUri() async {
- addSource('/home/test/lib/my_lib.dart', r'''
+ addSource('$testPackageLibPath/my_lib.dart', r'''
import 'dart:collection';
List<HashMap<String, int>> getMap() => null;
''');
@@ -173,7 +173,7 @@
}
Future<void> test_local_addImport_dartUri() async {
- addSource('/home/test/lib/my_lib.dart', r'''
+ addSource('$testPackageLibPath/my_lib.dart', r'''
import 'dart:collection';
HashMap<String, int> getMap() => null;
''');
@@ -194,7 +194,7 @@
}
Future<void> test_local_addImport_notLibraryUnit() async {
- addSource('/home/test/lib/my_lib.dart', r'''
+ addSource('$testPackageLibPath/my_lib.dart', r'''
import 'dart:collection';
HashMap<String, int> getMap() => null;
''');
@@ -211,7 +211,7 @@
}
''');
- var appPath = convertPath('/home/test/lib/app.dart');
+ var appPath = convertPath('$testPackageLibPath/app.dart');
addSource(appPath, appCode);
await analyzeTestPackageFiles();
await resolveTestFile();
@@ -646,7 +646,7 @@
}
Future<void> test_privateType_closureParameter() async {
- addSource('/home/test/lib/my_lib.dart', '''
+ addSource('$testPackageLibPath/my_lib.dart', '''
library my_lib;
class A {}
class _B extends A {}
@@ -662,7 +662,7 @@
}
Future<void> test_privateType_declaredIdentifier() async {
- addSource('/home/test/lib/my_lib.dart', '''
+ addSource('$testPackageLibPath/my_lib.dart', '''
library my_lib;
class A {}
class _B extends A {}
@@ -683,7 +683,7 @@
Future<void> test_privateType_list() async {
// This is now failing because we're suggesting "List" rather than nothing.
// Is it really better to produce nothing?
- addSource('/home/test/lib/my_lib.dart', '''
+ addSource('$testPackageLibPath/my_lib.dart', '''
library my_lib;
class A {}
class _B extends A {}
@@ -721,7 +721,7 @@
}
Future<void> test_privateType_variable() async {
- addSource('/home/test/lib/my_lib.dart', '''
+ addSource('$testPackageLibPath/my_lib.dart', '''
library my_lib;
class A {}
class _B extends A {}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
index 4f99ef9..37f3d66 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
@@ -20,12 +20,12 @@
AssistKind get kind => DartAssistKind.CONVERT_PART_OF_TO_URI;
Future<void> test_nonSibling() async {
- addSource('/home/test/lib/foo.dart', '''
+ addSource('$testPackageLibPath/foo.dart', '''
library foo;
part 'src/bar.dart';
''');
- testFile = convertPath('/home/test/lib/src/bar.dart');
+ testFile = convertPath('$testPackageLibPath/src/bar.dart');
addTestSource('''
part of foo;
''');
@@ -38,12 +38,12 @@
}
Future<void> test_sibling() async {
- addSource('/home/test/lib/foo.dart', '''
+ addSource('$testPackageLibPath/foo.dart', '''
library foo;
part 'bar.dart';
''');
- testFile = convertPath('/home/test/lib/bar.dart');
+ testFile = convertPath('$testPackageLibPath/bar.dart');
addTestSource('''
part of foo;
''');
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
index 1fe3d84..3665770 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_PACKAGE_IMPORT;
Future<void> test_fileName_onImport() async {
- addSource('/home/test/lib/foo.dart', '');
+ addSource('$testPackageLibPath/foo.dart', '');
await resolveTestCode('''
import 'foo.dart';
@@ -33,7 +33,7 @@
}
Future<void> test_fileName_onUri() async {
- addSource('/home/test/lib/foo.dart', '');
+ addSource('$testPackageLibPath/foo.dart', '');
await resolveTestCode('''
import 'foo.dart';
@@ -52,8 +52,8 @@
}
Future<void> test_nonPackage_Uri() async {
- addSource('/home/test/lib/foo.dart', '');
- testFile = convertPath('/home/test/lib/src/test.dart');
+ addSource('$testPackageLibPath/foo.dart', '');
+ testFile = convertPath('$testPackageLibPath/src/test.dart');
await resolveTestCode('''
import 'dart:core';
''');
@@ -63,7 +63,7 @@
}
Future<void> test_packageUri() async {
- addSource('/home/test/lib/foo.dart', '');
+ addSource('$testPackageLibPath/foo.dart', '');
await resolveTestCode('''
import 'package:test/foo.dart';
@@ -73,9 +73,9 @@
}
Future<void> test_path() async {
- addSource('/home/test/lib/foo/bar.dart', '');
+ addSource('$testPackageLibPath/foo/bar.dart', '');
- testFile = convertPath('/home/test/lib/src/test.dart');
+ testFile = convertPath('$testPackageLibPath/src/test.dart');
await resolveTestCode('''
import '../foo/bar.dart';
@@ -89,7 +89,7 @@
Future<void> test_relativeImport_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.avoid_relative_lib_imports]);
verifyNoTestUnitErrors = false;
- addSource('/home/test/lib/foo.dart', '');
+ addSource('$testPackageLibPath/foo.dart', '');
await resolveTestCode('''
import '../lib/foo.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart b/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
index 58b527a..320890d 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
@@ -85,7 +85,7 @@
}
Future<void> test_setterOnDirective() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
void set setter(int i) {}
''');
await resolveTestCode('''
diff --git a/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
index 4fb3e72..b02dad3 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
@@ -120,7 +120,7 @@
}
Future<void> test_privateType() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
_B b => _B();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart
index 8ff04db..6cc2306 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart
@@ -40,7 +40,7 @@
FixKind get kind => DartFixKind.ADD_LATE;
Future<void> test_changeInImportedLib() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class C {
final String s;
}
@@ -56,11 +56,11 @@
class C {
late final String s;
}
-''', target: '/home/test/lib/a.dart');
+''', target: '$testPackageLibPath/a.dart');
}
Future<void> test_changeInPart() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
part 'test.dart';
class C {
@@ -80,7 +80,7 @@
class C {
late final String s;
}
-''', target: '/home/test/lib/a.dart');
+''', target: '$testPackageLibPath/a.dart');
}
Future<void> test_withFinal() async {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart
index dc08b79..798725d 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart
@@ -102,7 +102,7 @@
}
Future<void> test_constructor_single() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
class A {
A({required int a}) {}
}
@@ -126,7 +126,7 @@
}
Future<void> test_constructor_single_closure() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
typedef void VoidCallback();
class A {
@@ -152,7 +152,7 @@
}
Future<void> test_constructor_single_closure2() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
typedef void Callback(e);
class A {
@@ -178,7 +178,7 @@
}
Future<void> test_constructor_single_closure3() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
typedef void Callback(a,b,c);
class A {
@@ -204,7 +204,7 @@
}
Future<void> test_constructor_single_closure4() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
typedef int Callback(int a, String b,c);
class A {
@@ -230,7 +230,7 @@
}
Future<void> test_constructor_single_closure_nnbd() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
typedef int Callback(int? a);
class A {
@@ -256,7 +256,7 @@
}
Future<void> test_constructor_single_closure_nnbd_from_legacy() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
// @dart = 2.8
import 'package:meta/meta.dart';
@@ -287,7 +287,7 @@
}
Future<void> test_constructor_single_closure_nnbd_into_legacy() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
typedef int Callback(int? a);
class A {
@@ -315,7 +315,7 @@
}
Future<void> test_constructor_single_list() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
class A {
A({required List<String> names}) {}
}
@@ -338,6 +338,28 @@
''');
}
+ Future<void> test_constructor_single_namedAnywhere() async {
+ addSource('$testPackageLibPath/a.dart', r'''
+class A {
+ A(int a, int b, {int? c, required int d}) {}
+}
+''');
+ await resolveTestCode('''
+import 'package:test/a.dart';
+
+void f() {
+ A(0, c: 1, 2);
+}
+''');
+ await assertHasFix('''
+import 'package:test/a.dart';
+
+void f() {
+ A(0, c: 1, 2, d: null);
+}
+''');
+ }
+
Future<void> test_multiple() async {
await resolveTestCode('''
test({required int a, required int bcd}) {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart
index 1a40007..e00bd37 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart
@@ -179,7 +179,7 @@
}
Future<void> test_privateType() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
_B b => _B();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart
index 63abb76..12c14cf3 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart
@@ -58,12 +58,12 @@
}
Future<void> test_method_importType() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
class A {
static foo() {}
}
''');
- addSource('/home/test/lib/b.dart', r'''
+ addSource('$testPackageLibPath/b.dart', r'''
import 'package:test/a.dart';
class B extends A {}
@@ -142,12 +142,12 @@
}
Future<void> test_property_importType() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
class A {
static get foo => null;
}
''');
- addSource('/home/test/lib/b.dart', r'''
+ addSource('$testPackageLibPath/b.dart', r'''
import 'package:test/a.dart';
class B extends A {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
index ca26deb..9db4307 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
@@ -57,7 +57,7 @@
}
Future<void> test_privateType() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
_B b => _B();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
index e4952f3..c59880a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
@@ -24,7 +24,7 @@
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/44673')
Future<void> test_singleFile() async {
writeTestPackageConfig(config: PackageConfigFileBuilder());
- addSource('/home/test/lib/bar.dart', 'class Bar {}');
+ addSource('$testPackageLibPath/bar.dart', 'class Bar {}');
testFile = convertPath('/home/test/tool/test.dart');
@@ -55,7 +55,7 @@
// This test fails because any attempt to specify a relative path that
// includes 'lib' (which the lint requires) results in a malformed URI when
// trying to resolve the import.
- newFile('/home/test/lib/foo/bar.dart', content: '''
+ newFile('$testPackageLibPath/foo/bar.dart', content: '''
class C {}
''');
await resolveTestCode('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart
index 260d20f..dfd5961 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart
@@ -23,13 +23,13 @@
String get lintCode => LintNames.prefer_relative_imports;
Future<void> test_singleFile() async {
- addSource('/home/test/lib/foo.dart', '''
+ addSource('$testPackageLibPath/foo.dart', '''
class C {}
''');
- addSource('/home/test/lib/bar.dart', '''
+ addSource('$testPackageLibPath/bar.dart', '''
class D {}
''');
- testFile = convertPath('/home/test/lib/src/test.dart');
+ testFile = convertPath('$testPackageLibPath/src/test.dart');
await resolveTestCode('''
import 'package:test/bar.dart';
@@ -55,10 +55,10 @@
String get lintCode => LintNames.prefer_relative_imports;
Future<void> test_relativeImport() async {
- addSource('/home/test/lib/foo.dart', '''
+ addSource('$testPackageLibPath/foo.dart', '''
class C {}
''');
- testFile = convertPath('/home/test/lib/src/test.dart');
+ testFile = convertPath('$testPackageLibPath/src/test.dart');
await resolveTestCode('''
import 'package:test/foo.dart';
C? c;
@@ -82,8 +82,8 @@
}
Future<void> test_relativeImportGarbledUri() async {
- addSource('/home/test/lib/foo.dart', '');
- testFile = convertPath('/home/test/lib/bar.dart');
+ addSource('$testPackageLibPath/foo.dart', '');
+ testFile = convertPath('$testPackageLibPath/bar.dart');
await resolveTestCode('''
import 'package:test/foo';
''');
@@ -96,10 +96,10 @@
}
Future<void> test_relativeImportRespectQuoteStyle() async {
- addSource('/home/test/lib/foo.dart', '''
+ addSource('$testPackageLibPath/foo.dart', '''
class C {}
''');
- testFile = convertPath('/home/test/lib/bar.dart');
+ testFile = convertPath('$testPackageLibPath/bar.dart');
await resolveTestCode('''
import "package:test/foo.dart";
C? c;
@@ -112,10 +112,10 @@
}
Future<void> test_relativeImportSameDirectory() async {
- addSource('/home/test/lib/foo.dart', '''
+ addSource('$testPackageLibPath/foo.dart', '''
class C {}
''');
- testFile = convertPath('/home/test/lib/bar.dart');
+ testFile = convertPath('$testPackageLibPath/bar.dart');
await resolveTestCode('''
import 'package:test/foo.dart';
C? c;
@@ -128,10 +128,10 @@
}
Future<void> test_relativeImportSubDirectory() async {
- addSource('/home/test/lib/baz/foo.dart', '''
+ addSource('$testPackageLibPath/baz/foo.dart', '''
class C {}
''');
- testFile = convertPath('/home/test/lib/test.dart');
+ testFile = convertPath('$testPackageLibPath/test.dart');
await resolveTestCode('''
import 'package:test/baz/foo.dart';
C? c;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart
index b8df672..976bef5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart
@@ -73,7 +73,7 @@
}
Future<void> test_inLibraryOfPrefix() async {
- addSource('/home/test/lib/lib.dart', r'''
+ addSource('$testPackageLibPath/lib.dart', r'''
class A {}
''');
@@ -92,7 +92,7 @@
class Test {
}
-''', target: '/home/test/lib/lib.dart');
+''', target: '$testPackageLibPath/lib.dart');
expect(change.linkedEditGroups, hasLength(1));
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
index 4831635..5a61202 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
@@ -50,10 +50,10 @@
}
Future<void> test_importType() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
class A {}
''');
- addSource('/home/test/lib/b.dart', r'''
+ addSource('$testPackageLibPath/b.dart', r'''
import 'package:test/a.dart';
class B {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart
index 8b98fb5..96d0f22 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart
@@ -41,7 +41,7 @@
FixKind get kind => DartFixKind.CREATE_CONSTRUCTOR;
Future<void> test_inLibrary_insteadOfSyntheticDefault() async {
- var a = newFile('/home/test/lib/a.dart', content: '''
+ var a = newFile('$testPackageLibPath/a.dart', content: '''
/// $_text200
class A {}
''').path;
@@ -61,7 +61,7 @@
}
Future<void> test_inLibrary_named() async {
- var a = newFile('/home/test/lib/a.dart', content: '''
+ var a = newFile('$testPackageLibPath/a.dart', content: '''
/// $_text200
class A {}
''').path;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
index 1e0b056..af26bc4 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
@@ -131,7 +131,7 @@
}
Future<void> test_getter_qualified_instance_differentLibrary() async {
- addSource('/home/test/lib/other.dart', '''
+ addSource('$testPackageLibPath/other.dart', '''
/**
* A comment to push the offset of the braces for the following class
* declaration past the end of the content of the test file. Used to catch an
@@ -161,7 +161,7 @@
class A {
int test;
}
-''', target: '/home/test/lib/other.dart');
+''', target: '$testPackageLibPath/other.dart');
}
Future<void> test_getter_qualified_instance_dynamicType() async {
@@ -317,11 +317,11 @@
}
Future<void> test_importType() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
class A {}
''');
- addSource('/home/test/lib/b.dart', r'''
+ addSource('$testPackageLibPath/b.dart', r'''
import 'package:test/a.dart';
A getA() => null;
@@ -365,7 +365,7 @@
}
Future<void> test_inPart_imported() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
part of lib;
class A {}
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_file_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_file_test.dart
index 988c679..f9e4644 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_file_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_file_test.dart
@@ -29,7 +29,7 @@
var fileEdits = change.edits;
expect(fileEdits, hasLength(1));
var fileEdit = change.edits[0];
- expect(fileEdit.file, convertPath('/home/test/lib/my_file.dart'));
+ expect(fileEdit.file, convertPath('$testPackageLibPath/my_file.dart'));
expect(fileEdit.fileStamp, -1);
expect(fileEdit.edits, hasLength(1));
expect(
@@ -47,7 +47,7 @@
var fileEdits = change.edits;
expect(fileEdits, hasLength(1));
var fileEdit = change.edits[0];
- expect(fileEdit.file, convertPath('/home/test/lib/my_file.dart'));
+ expect(fileEdit.file, convertPath('$testPackageLibPath/my_file.dart'));
expect(fileEdit.fileStamp, -1);
expect(fileEdit.edits, hasLength(1));
expect(
@@ -72,7 +72,7 @@
var fileEdits = change.edits;
expect(fileEdits, hasLength(1));
var fileEdit = change.edits[0];
- expect(fileEdit.file, convertPath('/home/test/lib/a/bb/my_lib.dart'));
+ expect(fileEdit.file, convertPath('$testPackageLibPath/a/bb/my_lib.dart'));
expect(fileEdit.fileStamp, -1);
expect(fileEdit.edits, hasLength(1));
expect(
@@ -110,7 +110,7 @@
var fileEdits = change.edits;
expect(fileEdits, hasLength(1));
var fileEdit = change.edits[0];
- expect(fileEdit.file, convertPath('/home/test/lib/my_part.dart'));
+ expect(fileEdit.file, convertPath('$testPackageLibPath/my_part.dart'));
expect(fileEdit.fileStamp, -1);
expect(fileEdit.edits, hasLength(1));
expect(fileEdit.edits[0].replacement, contains("part of 'test.dart';"));
@@ -125,7 +125,7 @@
var fileEdits = change.edits;
expect(fileEdits, hasLength(1));
var fileEdit = change.edits[0];
- expect(fileEdit.file, convertPath('/home/test/lib/foo/my_part.dart'));
+ expect(fileEdit.file, convertPath('$testPackageLibPath/foo/my_part.dart'));
expect(fileEdit.fileStamp, -1);
expect(fileEdit.edits, hasLength(1));
expect(fileEdit.edits[0].replacement, contains("part of '../test.dart';"));
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
index 2d663fc..1018a76 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
@@ -259,10 +259,10 @@
}
Future<void> test_functionType_importType() async {
- addSource('/home/test/lib/a.dart', r'''
+ addSource('$testPackageLibPath/a.dart', r'''
class A {}
''');
- addSource('/home/test/lib/b.dart', r'''
+ addSource('$testPackageLibPath/b.dart', r'''
import 'package:test/a.dart';
useFunction(int g(A a)) {}
@@ -348,7 +348,7 @@
}
Future<void> test_importType() async {
- addSource('/home/test/lib/lib.dart', r'''
+ addSource('$testPackageLibPath/lib.dart', r'''
library lib;
import 'dart:async';
Future getFuture() => null;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
index 7c382e6..7566168 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
@@ -249,7 +249,7 @@
}
Future<void> test_qualified_instance_differentLibrary() async {
- addSource('/home/test/lib/other.dart', '''
+ addSource('$testPackageLibPath/other.dart', '''
/**
* A comment to push the offset of the braces for the following class
* declaration past the end of the content of the test file. Used to catch an
@@ -279,7 +279,7 @@
class A {
int get test => null;
}
-''', target: '/home/test/lib/other.dart');
+''', target: '$testPackageLibPath/other.dart');
}
Future<void> test_qualified_instance_dynamicType() async {
@@ -307,7 +307,7 @@
}
Future<void> test_qualified_instance_inPart_imported() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
part of lib;
class A {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
index 185784b..dbfcc51 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
@@ -834,8 +834,8 @@
}
''';
- addSource('/home/test/lib/test2.dart', code2);
- addSource('/home/test/lib/test3.dart', r'''
+ addSource('$testPackageLibPath/test2.dart', code2);
+ addSource('$testPackageLibPath/test3.dart', r'''
library test3;
class E {}
''');
@@ -855,11 +855,11 @@
class D {
void foo(bbb.E e) {}
}
-''', target: '/home/test/lib/test2.dart');
+''', target: '$testPackageLibPath/test2.dart');
}
Future<void> test_parameterType_inTargetUnit() async {
- addSource('/home/test/lib/test2.dart', r'''
+ addSource('$testPackageLibPath/test2.dart', r'''
class D {
}
@@ -880,7 +880,7 @@
}
class E {}
-''', target: '/home/test/lib/test2.dart');
+''', target: '$testPackageLibPath/test2.dart');
}
Future<void> test_static() async {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart
index b0871a1..fb68eca 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart
@@ -35,7 +35,7 @@
var libCode = r'''
class A {}
''';
- addSource('/home/test/lib/lib.dart', libCode);
+ addSource('$testPackageLibPath/lib.dart', libCode);
await resolveTestCode('''
import 'lib.dart' as lib;
@@ -50,7 +50,7 @@
mixin Test {
}
-''', target: '/home/test/lib/lib.dart');
+''', target: '$testPackageLibPath/lib.dart');
expect(change.linkedEditGroups, hasLength(1));
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
index 4534817..fea7674 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
@@ -245,7 +245,7 @@
}
Future<void> test_qualified_instance_differentLibrary() async {
- addSource('/home/test/lib/other.dart', '''
+ addSource('$testPackageLibPath/other.dart', '''
/**
* A comment to push the offset of the braces for the following class
* declaration past the end of the content of the test file. Used to catch an
@@ -274,7 +274,7 @@
class A {
set test(int test) {}
}
-''', target: '/home/test/lib/other.dart');
+''', target: '$testPackageLibPath/other.dart');
}
Future<void> test_qualified_instance_dynamicType() async {
@@ -302,7 +302,7 @@
}
Future<void> test_qualified_instance_inPart_imported() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
part of lib;
class A {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test.dart
index 6fc6671..82353b0 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/data_driven_test.dart
@@ -1134,7 +1134,7 @@
- kind: 'rename'
newName: 'New'
''');
- addSource('/home/test/lib/test.config', '''
+ addSource('$testPackageLibPath/test.config', '''
'Rename to New':
bulkApply: true
''');
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 42d762b..4205071 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
@@ -33,7 +33,7 @@
addSource('/home/test/pubspec.yaml', '');
- var testFile = convertPath('/home/test/lib/test.dart');
+ var testFile = convertPath('$testPackageLibPath/test.dart');
addSource(testFile, '');
var result = await session.getResolvedLibraryValid(testFile);
var sets = manager.forLibrary(result.element);
@@ -44,7 +44,7 @@
// addTestPackageDependency('p1', '/.pub-cache/p1');
// addTestPackageDependency('p2', '/.pub-cache/p2');
addSource('/home/test/pubspec.yaml', '');
- var testFile = convertPath('/home/test/lib/test.dart');
+ var testFile = convertPath('$testPackageLibPath/test.dart');
addSource(testFile, '');
var result = await session.getResolvedLibraryValid(testFile);
var sets = manager.forLibrary(result.element);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart b/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart
index 44650b0..50411cb 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart
@@ -90,9 +90,8 @@
/// The processor used to compute bulk fixes.
late BulkFixProcessor processor;
- /// Return a list of the experiments that are to be enabled for tests in this
- /// class, or `null` if there are no experiments that should be enabled.
- List<String>? get experiments => null;
+ @override
+ List<String> get experiments => const [];
/// Return the lint code being tested.
String? get lintCode => null;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart
index 9630237..8779367 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart
@@ -39,7 +39,7 @@
}
Future<void> test_withExtension() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class C {}
extension E on int {
static String m() => '';
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
index 5173579..a677f3a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
@@ -24,7 +24,7 @@
FixKind get kind => DartFixKind.IMPORT_LIBRARY_PROJECT1;
Future<void> test_alreadyImported_package() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class A {}
class B {}
''');
@@ -40,14 +40,14 @@
}
Future<void> test_extension_notImported_field_onThisType_fromClass() async {
- addUnimportedFile('/home/test/lib/lib2.dart', '''
+ addUnimportedFile('$testPackageLibPath/lib2.dart', '''
import 'package:test/lib1.dart';
extension E on C {
int m() => 0;
}
''');
- addSource('/home/test/lib/lib1.dart', '''
+ addSource('$testPackageLibPath/lib1.dart', '''
class C {}
''');
await resolveTestCode('''
@@ -68,7 +68,7 @@
}
Future<void> test_extension_notImported_getter() async {
- addUnimportedFile('/home/test/lib/lib.dart', '''
+ addUnimportedFile('$testPackageLibPath/lib.dart', '''
extension E on String {
int get m => 0;
}
@@ -88,7 +88,7 @@
}
Future<void> test_extension_notImported_method() async {
- addUnimportedFile('/home/test/lib/lib.dart', '''
+ addUnimportedFile('$testPackageLibPath/lib.dart', '''
extension E on String {
void m() {}
}
@@ -108,7 +108,7 @@
}
Future<void> test_extension_notImported_method_extendsGeneric() async {
- addUnimportedFile('/home/test/lib/lib.dart', '''
+ addUnimportedFile('$testPackageLibPath/lib.dart', '''
import 'package:test/lib1.dart';
extension E<T extends num> on List<T> {
@@ -130,14 +130,14 @@
}
Future<void> test_extension_notImported_method_onThisType_fromClass() async {
- addUnimportedFile('/home/test/lib/lib2.dart', '''
+ addUnimportedFile('$testPackageLibPath/lib2.dart', '''
import 'package:test/lib1.dart';
extension E on C {
void m() {}
}
''');
- addSource('/home/test/lib/lib1.dart', '''
+ addSource('$testPackageLibPath/lib1.dart', '''
class C {}
''');
await resolveTestCode('''
@@ -163,14 +163,14 @@
Future<void>
test_extension_notImported_method_onThisType_fromExtension() async {
- addUnimportedFile('/home/test/lib/lib2.dart', '''
+ addUnimportedFile('$testPackageLibPath/lib2.dart', '''
import 'package:test/lib1.dart';
extension E on C {
void m() {}
}
''');
- addSource('/home/test/lib/lib1.dart', '''
+ addSource('$testPackageLibPath/lib1.dart', '''
class C {}
''');
await resolveTestCode('''
@@ -195,7 +195,7 @@
}
Future<void> test_extension_notImported_operator() async {
- addUnimportedFile('/home/test/lib/lib.dart', '''
+ addUnimportedFile('$testPackageLibPath/lib.dart', '''
extension E on String {
String operator -(String other) => this;
}
@@ -215,7 +215,7 @@
}
Future<void> test_extension_notImported_setter() async {
- addUnimportedFile('/home/test/lib/lib.dart', '''
+ addUnimportedFile('$testPackageLibPath/lib.dart', '''
extension E on String {
set m(int v) {}
}
@@ -235,7 +235,7 @@
}
Future<void> test_invalidUri_interpolation() async {
- addSource('/home/test/lib/lib.dart', r'''
+ addSource('$testPackageLibPath/lib.dart', r'''
class Test {
const Test();
}
@@ -355,7 +355,7 @@
}
Future<void> test_relativeDirective() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class Foo {}
''');
await resolveTestCode('''
@@ -377,7 +377,7 @@
}
Future<void> test_relativeDirective_downOneDirectory() async {
- addSource('/home/test/lib/dir/a.dart', '''
+ addSource('$testPackageLibPath/dir/a.dart', '''
class Foo {}
''');
await resolveTestCode('''
@@ -394,7 +394,7 @@
Future<void> test_relativeDirective_preferRelativeImports() async {
createAnalysisOptionsFile(lints: [LintNames.prefer_relative_imports]);
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class Foo {}
''');
await resolveTestCode('''
@@ -416,10 +416,10 @@
}
Future<void> test_relativeDirective_upOneDirectory() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class Foo {}
''');
- testFile = convertPath('/home/test/lib/dir/test.dart');
+ testFile = convertPath('$testPackageLibPath/dir/test.dart');
await resolveTestCode('''
main() { new Foo(); }
''');
@@ -433,7 +433,7 @@
}
Future<void> test_withClass_annotation() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
library lib;
class Test {
const Test(int p);
@@ -454,7 +454,7 @@
}
Future<void> test_withClass_catchClause() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class Test {}
''');
await resolveTestCode('''
@@ -480,11 +480,11 @@
}
Future<void> test_withClass_hasOtherLibraryWithPrefix() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
library a;
class One {}
''');
- addSource('/home/test/lib/b.dart', '''
+ addSource('$testPackageLibPath/b.dart', '''
library b;
class One {}
class Two {}
@@ -573,7 +573,7 @@
}
Future<void> test_withClass_instanceCreation_const() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class Test {
const Test();
}
@@ -593,7 +593,7 @@
}
Future<void> test_withClass_instanceCreation_const_namedConstructor() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class Test {
const Test.named();
}
@@ -613,7 +613,7 @@
}
Future<void> test_withClass_instanceCreation_implicit() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class Test {
const Test();
}
@@ -633,7 +633,7 @@
}
Future<void> test_withClass_instanceCreation_new() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class Test {
const Test();
}
@@ -653,7 +653,7 @@
}
Future<void> test_withClass_instanceCreation_new_namedConstructor() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class Test {
Test.named();
}
@@ -673,7 +673,7 @@
}
Future<void> test_withFunction() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
library lib;
myFunction() {}
''');
@@ -692,7 +692,7 @@
}
Future<void> test_withFunction_functionTopLevelVariable() async {
- addSource('/home/test/lib/lib.dart', 'var myFunction = () {};');
+ addSource('$testPackageLibPath/lib.dart', 'var myFunction = () {};');
await resolveTestCode('''
main() {
myFunction();
@@ -708,7 +708,7 @@
}
Future<void> test_withFunction_functionTopLevelVariableIdentifier() async {
- addSource('/home/test/lib/lib.dart', 'var myFunction = () {};');
+ addSource('$testPackageLibPath/lib.dart', 'var myFunction = () {};');
await resolveTestCode('''
main() {
myFunction;
@@ -724,7 +724,7 @@
}
Future<void> test_withFunction_identifier() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
library lib;
myFunction() {}
''');
@@ -744,7 +744,7 @@
@failingTest
Future<void> test_withFunction_nonFunctionType() async {
- addSource('/home/test/lib/lib.dart', 'int zero = 0;');
+ addSource('$testPackageLibPath/lib.dart', 'int zero = 0;');
await resolveTestCode('''
main() {
zero();
@@ -754,7 +754,7 @@
}
Future<void> test_withFunction_unresolvedMethod() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
library lib;
myFunction() {}
''');
@@ -777,7 +777,7 @@
}
Future<void> test_withFunctionTypeAlias() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
library lib;
typedef MyFunction();
''');
@@ -798,7 +798,7 @@
}
Future<void> test_withMixin() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
mixin Test {}
''');
await resolveTestCode('''
@@ -812,7 +812,7 @@
}
Future<void> test_withTopLevelVariable() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
library lib;
int MY_VAR = 42;
''');
@@ -955,7 +955,7 @@
}
Future<void> test_inLibSrc_thisContextRoot() async {
- addSource('/home/test/lib/src/lib.dart', 'class Test {}');
+ addSource('$testPackageLibPath/src/lib.dart', 'class Test {}');
await resolveTestCode('''
main() {
Test t;
@@ -973,7 +973,7 @@
}
Future<void> test_inLibSrc_thisContextRoot_extension() async {
- addSource('/home/test/lib/src/lib.dart', '''
+ addSource('$testPackageLibPath/src/lib.dart', '''
extension E on int {
static String m() => '';
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart
index 05ba8ce..7c57f67 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.IMPORT_LIBRARY_SHOW;
Future<void> test_extension_notShown_getter() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class C {}
extension E on String {
int get m => 0;
@@ -43,7 +43,7 @@
}
Future<void> test_extension_notShown_method() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class C {}
extension E on String {
void m() {}
@@ -66,7 +66,7 @@
}
Future<void> test_extension_notShown_operator() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class C {}
extension E on String {
String operator -(String other) => this;
@@ -89,7 +89,7 @@
}
Future<void> test_extension_notShown_setter() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class C {}
extension E on String {
set m(int v) {}
@@ -112,7 +112,7 @@
}
Future<void> test_override_samePackage() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class A {}
extension E on int {
String m() => '';
@@ -133,7 +133,7 @@
}
Future<void> test_package() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class A {}
class B {}
''');
@@ -175,7 +175,7 @@
}
Future<void> test_static_samePackage() async {
- addSource('/home/test/lib/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
class A {}
extension E on int {
static String m() => '';
diff --git a/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart b/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart
index 4a54aa0..8d5d664 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart
@@ -42,12 +42,12 @@
}
Future<void> test_organizePathImports() async {
- newFile('/home/test/lib/a.dart', content: '''
+ newFile('$testPackageLibPath/a.dart', content: '''
class A {
static void m() {}
}
''');
- newFile('/home/test/lib/a/b.dart', content: '''
+ newFile('$testPackageLibPath/a/b.dart', content: '''
class B {
static void m() {}
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/qualify_reference_test.dart b/pkg/analysis_server/test/src/services/correction/fix/qualify_reference_test.dart
index 5c92c08..6d3cf03 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/qualify_reference_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/qualify_reference_test.dart
@@ -43,7 +43,7 @@
}
Future<void> test_class_imported() async {
- newFile('/home/test/lib/a.dart', content: '''
+ newFile('$testPackageLibPath/a.dart', content: '''
class A {
static void m() {}
}
@@ -60,7 +60,7 @@
}
Future<void> test_class_importedWithPrefix() async {
- newFile('/home/test/lib/a.dart', content: '''
+ newFile('$testPackageLibPath/a.dart', content: '''
class A {
static void m() {}
}
@@ -104,12 +104,12 @@
}
Future<void> test_class_notImported() async {
- newFile('/home/test/lib/a.dart', content: '''
+ newFile('$testPackageLibPath/a.dart', content: '''
class A {
static void m() {}
}
''');
- newFile('/home/test/lib/b.dart', content: '''
+ newFile('$testPackageLibPath/b.dart', content: '''
import 'a.dart';
class B extends A {}
''');
@@ -148,7 +148,7 @@
}
Future<void> test_extension_imported() async {
- newFile('/home/test/lib/a.dart', content: '''
+ newFile('$testPackageLibPath/a.dart', content: '''
class A {
static void m() {}
}
@@ -165,7 +165,7 @@
}
Future<void> test_extension_importedWithPrefix() async {
- newFile('/home/test/lib/a.dart', content: '''
+ newFile('$testPackageLibPath/a.dart', content: '''
class A {
static void m() {}
}
@@ -209,12 +209,12 @@
}
Future<void> test_extension_notImported() async {
- newFile('/home/test/lib/a.dart', content: '''
+ newFile('$testPackageLibPath/a.dart', content: '''
class A {
static void m() {}
}
''');
- newFile('/home/test/lib/b.dart', content: '''
+ newFile('$testPackageLibPath/b.dart', content: '''
import 'a.dart';
class B extends A {}
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_argument_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_argument_test.dart
index 2bfbc3e..9d27944 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_argument_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_argument_test.dart
@@ -90,7 +90,7 @@
@override
String get lintCode => LintNames.avoid_redundant_argument_values;
- Future<void> test_named_param() async {
+ Future<void> test_named() async {
await resolveTestCode('''
void f({bool valWithDefault = true, bool? val}) {}
@@ -107,7 +107,27 @@
''');
}
- Future<void> test_named_param_2() async {
+ @FailingTest(
+ issue: 'https://github.com/dart-lang/linter/issues/3082',
+ )
+ Future<void> test_named_betweenRequiredPositional() async {
+ await resolveTestCode('''
+void foo(int a, int b, {bool c = true}) {}
+
+void f() {
+ foo(0, c: true, 1);
+}
+''');
+ await assertHasFix('''
+void foo(int a, int b, {bool c = true}) {}
+
+void f() {
+ foo(0, 1);
+}
+''');
+ }
+
+ Future<void> test_named_hasOtherNamed() async {
await resolveTestCode('''
void f({bool valWithDefault = true, bool? val}) {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart
index 33821d3..4dec631 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart
@@ -126,7 +126,7 @@
@FailingTest(issue: 'https://github.com/dart-lang/linter/issues/1997')
Future<void> test_method_nullSafety_optIn_fromOptOut() async {
createAnalysisOptionsFile(lints: [lintCode]);
- newFile('/home/test/lib/a.dart', content: r'''
+ newFile('$testPackageLibPath/a.dart', content: r'''
class A {
int foo() => 0;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_test.dart
index da085a6..ac72607 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_test.dart
@@ -172,7 +172,7 @@
}
Future<void> test_privateType() async {
- addSource('/home/test/lib/a.dart', '''
+ addSource('$testPackageLibPath/a.dart', '''
class A {
_B b => _B();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_extension_name_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_extension_name_test.dart
index 0bf4a84..eaf03e1 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_extension_name_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_extension_name_test.dart
@@ -62,7 +62,7 @@
}
Future<void> test_qualified() async {
- newFile('/home/test/lib/ext.dart', content: '''
+ newFile('$testPackageLibPath/ext.dart', content: '''
extension E on String {
static int m() => 0;
}
diff --git a/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart b/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
index 0339409..d6935bf 100644
--- a/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
+++ b/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
@@ -934,7 +934,8 @@
case 'bool':
return FromJsonFunction('jsonDecoder.decodeBool');
case 'double':
- return FromJsonFunction('jsonDecoder.decodeDouble');
+ return FromJsonFunction('jsonDecoder.decodeDouble',
+ castType: 'Object');
case 'int':
case 'long':
return FromJsonFunction('jsonDecoder.decodeInt');
@@ -1120,14 +1121,17 @@
@override
final String asClosure;
- FromJsonFunction(this.asClosure);
+ final String? castType;
+
+ FromJsonFunction(this.asClosure, {this.castType});
@override
bool get isIdentity => false;
@override
- String asSnippet(String jsonPath, String json) =>
- '$asClosure($jsonPath, $json)';
+ String asSnippet(String jsonPath, String json) => castType == null
+ ? '$asClosure($jsonPath, $json)'
+ : '$asClosure($jsonPath, $json as $castType)';
}
/// Representation of FromJsonCode for the identity transformation.
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
index 2ebd67f..7bb9c83 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
@@ -11565,7 +11565,7 @@
double? doubleValue;
if (json.containsKey('doubleValue')) {
doubleValue = jsonDecoder.decodeDouble(
- jsonPath + '.doubleValue', json['doubleValue']);
+ jsonPath + '.doubleValue', json['doubleValue'] as Object);
}
int? intValue;
if (json.containsKey('intValue')) {
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index 7561115..bb33038 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -20,27 +20,6 @@
import 'package:analyzer/src/generated/element_type_provider.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
-/// Transforms the given [list] by applying [transform] to all its elements.
-///
-/// If no changes are made (i.e. the return value of [transform] is identical
-/// to its parameter each time it is invoked), the original list is returned.
-List<T> _transformOrShare<T>(List<T> list, T Function(T) transform) {
- var length = list.length;
- for (int i = 0; i < length; i++) {
- var item = list[i];
- var transformed = transform(item);
- if (!identical(item, transformed)) {
- var newList = list.toList();
- newList[i] = transformed;
- for (i++; i < length; i++) {
- newList[i] = transform(list[i]);
- }
- return newList;
- }
- }
- return list;
-}
-
/// The [Type] representing the type `dynamic`.
class DynamicTypeImpl extends TypeImpl implements DynamicType {
/// The unique instance of this class.
@@ -247,16 +226,12 @@
var substitution = Substitution.fromPairs(typeFormals, argumentTypes);
- ParameterElement transformParameter(ParameterElement p) {
- return p.copyWith(
- type: substitution.substituteType(p.type),
- );
- }
-
return FunctionTypeImpl(
returnType: substitution.substituteType(returnType),
typeFormals: const [],
- parameters: _transformOrShare(parameters, transformParameter),
+ parameters: parameters
+ .map((p) => p.copyWith(type: substitution.substituteType(p.type)))
+ .toList(),
nullabilitySuffix: nullabilitySuffix,
);
}
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 3c5f245..49838e5 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -178,8 +178,7 @@
enqueuer = EnqueueTask(this);
tasks = [
- kernelLoader = KernelLoaderTask(
- options, provider, _outputProvider, reporter, measurer),
+ kernelLoader = KernelLoaderTask(options, provider, reporter, measurer),
kernelFrontEndTask,
globalInference = GlobalTypeInferenceTask(this),
deferredLoadTask = frontendStrategy.createDeferredLoadTask(this),
@@ -306,7 +305,6 @@
if (retainDataForTesting) {
componentForTesting = result.component;
}
- if (options.cfeOnly) return;
frontendStrategy.registerLoadedLibraries(result);
@@ -314,12 +312,34 @@
await runModularAnalysis(result);
} else {
List<ModuleData> data;
- if (options.modularAnalysisInputs != null) {
+ if (options.hasModularAnalysisInputs) {
data =
await serializationTask.deserializeModuleData(result.component);
}
frontendStrategy.registerModuleData(data);
- await compileFromKernel(result.rootLibraryUri, result.libraries);
+
+ // After we've deserialized modular data, we set and verify the main
+ // method as well as trim the component of any unnecessary dependencies.
+ // Note: It is critical we wait to trim the dill until after we've
+ // deserialized modular data because some of this data may reference
+ // 'trimmed' elements.
+ if (options.fromDill) {
+ if (options.entryUri != null) {
+ result.setMainAndTrimComponent(options.entryUri);
+ }
+ if (result.component.mainMethod == null) {
+ // TODO(sigmund): move this so that we use the same error template
+ // from the CFE.
+ _reporter.reportError(_reporter.createMessage(NO_LOCATION_SPANNABLE,
+ MessageKind.GENERIC, {'text': "No 'main' method found."}));
+ return;
+ }
+ }
+ if (options.cfeOnly) {
+ await serializationTask.serializeComponent(result.component);
+ } else {
+ await compileFromKernel(result.rootLibraryUri, result.libraries);
+ }
}
}
}
diff --git a/pkg/compiler/lib/src/ir/impact.dart b/pkg/compiler/lib/src/ir/impact.dart
index f3d8702..3e7f7fca 100644
--- a/pkg/compiler/lib/src/ir/impact.dart
+++ b/pkg/compiler/lib/src/ir/impact.dart
@@ -858,4 +858,11 @@
void visitNullConstant(ir.NullConstant node) {
registry.registerNullLiteral();
}
+
+ @override
+ void visitConstructorTearOffConstant(ir.ConstructorTearOffConstant node) {
+ // The CFE encoding of redirecting factories, which dart2js doesn't use,
+ // uses ConstructorTearOff(Constant) to point to its effective target.
+ // However, these should be safe to ignore.
+ }
}
diff --git a/pkg/compiler/lib/src/kernel/loader.dart b/pkg/compiler/lib/src/kernel/loader.dart
index 57c32f2..dbefdbb 100644
--- a/pkg/compiler/lib/src/kernel/loader.dart
+++ b/pkg/compiler/lib/src/kernel/loader.dart
@@ -9,7 +9,6 @@
import 'package:front_end/src/fasta/kernel/utils.dart';
import 'package:kernel/ast.dart' as ir;
import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
-import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
import 'package:kernel/kernel.dart' hide LibraryDependency, Combinator;
@@ -20,7 +19,6 @@
import '../common/tasks.dart' show CompilerTask, Measurer;
import '../common.dart';
import '../options.dart';
-import '../util/sink_adapter.dart';
import 'front_end_adapter.dart';
import 'dart2js_target.dart' show Dart2jsTarget;
@@ -34,7 +32,6 @@
final DiagnosticReporter _reporter;
final api.CompilerInput _compilerInput;
- final api.CompilerOutput _compilerOutput;
final CompilerOptions _options;
@@ -47,58 +44,13 @@
/// This is used for testing.
bool forceSerialization = false;
- KernelLoaderTask(this._options, this._compilerInput, this._compilerOutput,
- this._reporter, Measurer measurer)
+ KernelLoaderTask(
+ this._options, this._compilerInput, this._reporter, Measurer measurer)
: initializedCompilerState = _options.kernelInitializedCompilerState,
super(measurer);
@override
String get name => 'kernel loader';
- Library findEntryLibrary(Component component, Uri entryUri) {
- var entryLibrary = component.libraries
- .firstWhere((l) => l.fileUri == entryUri, orElse: () => null);
- if (entryLibrary == null) {
- throw ArgumentError('Entry uri $entryUri not found in dill.');
- }
- return entryLibrary;
- }
-
- ir.Reference findMainMethod(Library entryLibrary) {
- var mainMethod = entryLibrary.procedures
- .firstWhere((p) => p.name.text == 'main', orElse: () => null);
-
- // In some cases, a main method is defined in another file, and then
- // exported. In these cases, we search for the main method in
- // [additionalExports].
- ir.Reference mainMethodReference;
- if (mainMethod == null) {
- mainMethodReference = entryLibrary.additionalExports.firstWhere(
- (p) => p.canonicalName.name == 'main',
- orElse: () => null);
- } else {
- mainMethodReference = mainMethod.reference;
- }
- if (mainMethodReference == null) {
- throw ArgumentError(
- 'Entry uri ${entryLibrary.fileUri} has no main method.');
- }
- return mainMethodReference;
- }
-
- Set<Library> computeRequiredLibraries(Library entryLibrary) {
- var toVisit = [entryLibrary];
- var visited = <Library>{entryLibrary};
- while (toVisit.isNotEmpty) {
- var library = toVisit.removeLast();
- for (var dependency in library.dependencies) {
- var target = dependency.targetLibrary;
- if (visited.add(target)) {
- toVisit.add(target);
- }
- }
- }
- return visited;
- }
/// Loads an entire Kernel [Component] from a file on disk.
Future<KernelResult> load() {
@@ -116,9 +68,6 @@
var resolvedUri = _options.compilationTarget;
ir.Component component;
List<Uri> moduleLibraries = const [];
- var isDill = resolvedUri.path.endsWith('.dill') ||
- resolvedUri.path.endsWith('.gdill') ||
- resolvedUri.path.endsWith('.mdill');
void inferNullSafetyMode(bool isSound) {
if (_options.nullSafetyMode == NullSafetyMode.unspecified) {
@@ -131,7 +80,7 @@
assert(_options.nullSafetyMode != NullSafetyMode.unspecified);
}
- if (isDill) {
+ if (_options.fromDill) {
component = ir.Component();
Future<void> read(Uri uri) async {
api.Input input = await _compilerInput.readFromUri(uri,
@@ -141,15 +90,6 @@
await read(resolvedUri);
- // If an entryUri is supplied, we use it to manually select the main
- // method.
- Library entryLibrary;
- if (_options.entryUri != null) {
- entryLibrary = findEntryLibrary(component, _options.entryUri);
- var mainMethod = findMainMethod(entryLibrary);
- component.setMainMethodAndMode(mainMethod, true, component.mode);
- }
-
if (_options.modularMode) {
moduleLibraries =
component.libraries.map((lib) => lib.importUri).toList();
@@ -182,38 +122,12 @@
if (platformUri != resolvedUri) await read(platformUri);
}
- // Concatenate dills, trim the resulting monolithic dill, and then
- // reset the main method.
- var mainMethod = component.mainMethodName;
- var mainMode = component.mode;
+ // Concatenate dills.
if (_options.dillDependencies != null) {
for (Uri dependency in _options.dillDependencies) {
await read(dependency);
}
}
- if (entryLibrary != null) {
- var requiredLibraries = computeRequiredLibraries(entryLibrary);
- for (var library in component.libraries) {
- if (library.importUri.scheme == 'dart') {
- requiredLibraries.add(library);
- }
- }
- component = ir.Component(
- libraries: requiredLibraries.toList(),
- uriToSource: component.uriToSource,
- nameRoot: component.root);
- }
- component.setMainMethodAndMode(mainMethod, true, mainMode);
-
- // This is not expected to be null when creating a whole-program .dill
- // file, but needs to be checked for modular inputs.
- if (component.mainMethod == null && !_options.modularMode) {
- // TODO(sigmund): move this so that we use the same error template
- // from the CFE.
- _reporter.reportError(_reporter.createMessage(NO_LOCATION_SPANNABLE,
- MessageKind.GENERIC, {'text': "No 'main' method found."}));
- return null;
- }
} else {
bool verbose = false;
Target target =
@@ -266,18 +180,6 @@
validateNullSafetyMode();
}
- if (_options.cfeOnly) {
- measureSubtask('serialize dill', () {
- _reporter.log('Writing dill to ${_options.outputUri}');
- api.BinaryOutputSink dillOutput =
- _compilerOutput.createBinarySink(_options.outputUri);
- BinaryOutputSinkAdapter irSink = BinaryOutputSinkAdapter(dillOutput);
- BinaryPrinter printer = BinaryPrinter(irSink);
- printer.writeComponentFile(component);
- irSink.close();
- });
- }
-
if (forceSerialization) {
// TODO(johnniwinther): Remove this when #34942 is fixed.
List<int> data = serializeComponent(component);
@@ -324,7 +226,7 @@
/// Result of invoking the CFE to produce the kernel IR.
class KernelResult {
- final ir.Component component;
+ ir.Component component;
/// The [Uri] of the root library containing main.
/// Note: rootLibraryUri will be null for some modules, for example in the
@@ -348,6 +250,55 @@
KernelResult(this.component, this.rootLibraryUri, this.libraries,
this.moduleLibraries);
+ static Library _findEntryLibrary(Component component, Uri entryUri) {
+ var entryLibrary = component.libraries
+ .firstWhere((l) => l.fileUri == entryUri, orElse: () => null);
+ if (entryLibrary == null) {
+ throw ArgumentError('Entry uri $entryUri not found in dill.');
+ }
+ return entryLibrary;
+ }
+
+ static ir.Reference _findMainMethod(Library entryLibrary) {
+ var mainMethod = entryLibrary.procedures
+ .firstWhere((p) => p.name.text == 'main', orElse: () => null);
+
+ // In some cases, a main method is defined in another file, and then
+ // exported. In these cases, we search for the main method in
+ // [additionalExports].
+ ir.Reference mainMethodReference;
+ if (mainMethod == null) {
+ mainMethodReference = entryLibrary.additionalExports.firstWhere(
+ (p) => p.canonicalName.name == 'main',
+ orElse: () => null);
+ } else {
+ mainMethodReference = mainMethod.reference;
+ }
+ if (mainMethodReference == null) {
+ throw ArgumentError(
+ 'Entry uri ${entryLibrary.fileUri} has no main method.');
+ }
+ return mainMethodReference;
+ }
+
+ void setMainAndTrimComponent(Uri entryUri) {
+ var entryLibrary = _findEntryLibrary(component, entryUri);
+ var mainMethod = _findMainMethod(entryLibrary);
+ var irLibraryMap = <Uri, Library>{};
+ var irLibraries = <Library>[];
+ for (var library in component.libraries) {
+ irLibraryMap[library.importUri] = library;
+ }
+ for (var library in libraries) {
+ irLibraries.add(irLibraryMap[library]);
+ }
+ component = ir.Component(
+ libraries: irLibraries,
+ uriToSource: component.uriToSource,
+ nameRoot: component.root);
+ component.setMainMethodAndMode(mainMethod, true, component.mode);
+ }
+
@override
String toString() =>
'root=$rootLibraryUri,libraries=$libraries,module=$moduleLibraries';
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index e6db1d9..79d15b9 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -160,6 +160,13 @@
/// Returns the compilation target specified by these options.
Uri? get compilationTarget => inputDillUri ?? entryUri;
+ bool get fromDill {
+ var targetPath = compilationTarget!.path;
+ return targetPath.endsWith('.dill') ||
+ targetPath.endsWith('.gdill') ||
+ targetPath.endsWith('.mdill');
+ }
+
/// Location of the package configuration file.
///
/// If not null then [packageRoot] should be null.
@@ -185,6 +192,8 @@
List<Uri>? modularAnalysisInputs;
+ bool get hasModularAnalysisInputs => modularAnalysisInputs != null;
+
/// Location from which serialized inference data is read.
///
/// If this is set, the [entryUri] is expected to be a .dill file and the
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index 131d308..a25692d 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -1612,14 +1612,12 @@
var fn = node.function;
var body = _emitArgumentInitializers(fn, node.name.text);
- // Redirecting constructors: these are not allowed to have initializers,
- // and the redirecting ctor invocation runs before field initializers.
- var redirectCall = node.initializers
- .firstWhere((i) => i is RedirectingInitializer, orElse: () => null)
- as RedirectingInitializer;
-
- if (redirectCall != null) {
- body.add(_emitRedirectingConstructor(redirectCall, className));
+ // Redirecting constructors are not allowed to have conventional
+ // initializers but can have variable declarations in the form of
+ // initializers to support named arguments appearing anywhere in the
+ // arguments list.
+ if (node.initializers.any((i) => i is RedirectingInitializer)) {
+ body.add(_emitRedirectingConstructor(node.initializers, className));
return body;
}
@@ -1652,15 +1650,23 @@
}
js_ast.Statement _emitRedirectingConstructor(
- RedirectingInitializer node, js_ast.Expression className) {
- var ctor = node.target;
- // We can't dispatch to the constructor with `this.new` as that might hit a
- // derived class constructor with the same name.
- return js.statement('#.#.call(this, #);', [
- className,
- _constructorName(ctor.name.text),
- _emitArgumentList(node.arguments, types: false)
- ]);
+ List<Initializer> initializers, js_ast.Expression className) {
+ var jsInitializers = <js_ast.Statement>[
+ for (var init in initializers)
+ if (init is LocalInitializer)
+ // Temporary locals are created when named arguments don't appear at
+ // the end of the arguments list.
+ visitVariableDeclaration(init.variable)
+ else if (init is RedirectingInitializer)
+ // We can't dispatch to the constructor with `this.new` as that might
+ // hit a derived class constructor with the same name.
+ js.statement('#.#.call(this, #);', [
+ className,
+ _constructorName(init.target.name.text),
+ _emitArgumentList(init.arguments, types: false)
+ ])
+ ];
+ return js_ast.Block(jsInitializers);
}
js_ast.Statement _emitSuperConstructorCallIfNeeded(
@@ -5373,7 +5379,16 @@
// setter, or method. For the case of tearing off a `super` method in
// contexts where `super` isn't allowed, see [_emitSuperTearoff].
var name = member.name.text;
- var jsMethod = _superHelpers.putIfAbsent(name, () {
+ var getter = (member is Field && !setter) ||
+ (member is Procedure && member.isGetter);
+ // Prefix applied to the name only used in the compiler for a map key. This
+ // name does not make its way into the compiled program.
+ var lookupPrefix = setter
+ ? r'set$'
+ : getter
+ ? r'get$'
+ : '';
+ var jsMethod = _superHelpers.putIfAbsent('$lookupPrefix$name', () {
var isAccessor = member is Procedure ? member.isAccessor : true;
if (isAccessor) {
assert(member is Procedure
diff --git a/tests/language/super/regress47698_test.dart b/tests/language/super/regress47698_test.dart
new file mode 100644
index 0000000..bce31aa
--- /dev/null
+++ b/tests/language/super/regress47698_test.dart
@@ -0,0 +1,62 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+// Regression test for https://github.com/dart-lang/sdk/issues/47698.
+
+// Exposes a class field.
+class A {
+ int i;
+ A(this.i);
+}
+
+// Exposes a getter/setter pair.
+class B {
+ int _j;
+ int get j => _j;
+ set j(int x) => _j = x;
+ B(this._j);
+}
+
+// A super class field used in constructor as getter and setter.
+class C extends A {
+ C(int val) : super(val) {
+ var x = super.i + 10; // Getter is used first.
+ super.i = x + 100; // Boom! Missing setter.
+ }
+}
+
+class D extends A {
+ D(int val) : super(val) {
+ super.i = 100; // Setter is used first.
+ super.i = super.i + 10 + val; // Boom! Missing getter.
+ }
+}
+
+// Actual super getter and setter used in constructor
+class E extends B {
+ E(int val) : super(val) {
+ var x = super.j + 10; // Getter is used first.
+ super.j = x + 100; // Boom! Missing setter.
+ }
+}
+
+class F extends B {
+ F(int val) : super(val) {
+ super.j = 100; // Setter is used first.
+ super.j = super.j + 10 + val; // Boom! Missing getter.
+ }
+}
+
+void main() {
+ var c = C(1);
+ Expect.equals(c.i, 111);
+ var d = D(1);
+ Expect.equals(d.i, 111);
+ var e = E(1);
+ Expect.equals(e.j, 111);
+ var f = F(1);
+ Expect.equals(f.j, 111);
+}
diff --git a/tests/language_2/super/regress47698_test.dart b/tests/language_2/super/regress47698_test.dart
new file mode 100644
index 0000000..770878e
--- /dev/null
+++ b/tests/language_2/super/regress47698_test.dart
@@ -0,0 +1,64 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// @dart = 2.9
+
+import "package:expect/expect.dart";
+
+// Regression test for https://github.com/dart-lang/sdk/issues/47698.
+
+// Exposes a class field.
+class A {
+ int i;
+ A(this.i);
+}
+
+// Exposes a getter/setter pair.
+class B {
+ int _j;
+ int get j => _j;
+ set j(int x) => _j = x;
+ B(this._j);
+}
+
+// A super class field used in constructor as getter and setter.
+class C extends A {
+ C(int val) : super(val) {
+ var x = super.i + 10; // Getter is used first.
+ super.i = x + 100; // Boom! Missing setter.
+ }
+}
+
+class D extends A {
+ D(int val) : super(val) {
+ super.i = 100; // Setter is used first.
+ super.i = super.i + 10 + val; // Boom! Missing getter.
+ }
+}
+
+// Actual super getter and setter used in constructor
+class E extends B {
+ E(int val) : super(val) {
+ var x = super.j + 10; // Getter is used first.
+ super.j = x + 100; // Boom! Missing setter.
+ }
+}
+
+class F extends B {
+ F(int val) : super(val) {
+ super.j = 100; // Setter is used first.
+ super.j = super.j + 10 + val; // Boom! Missing getter.
+ }
+}
+
+void main() {
+ var c = C(1);
+ Expect.equals(c.i, 111);
+ var d = D(1);
+ Expect.equals(d.i, 111);
+ var e = E(1);
+ Expect.equals(e.j, 111);
+ var f = F(1);
+ Expect.equals(f.j, 111);
+}
diff --git a/tools/VERSION b/tools/VERSION
index 02dcfb9..fc6b365 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 16
PATCH 0
-PRERELEASE 74
+PRERELEASE 75
PRERELEASE_PATCH 0
\ No newline at end of file