Version 2.16.0-126.0.dev
Merge commit 'd5124446007246ca4ad2a47a0e926399ec369426' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index 284ed91..e95c948 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -11,7 +11,7 @@
"constraint, update this by running tools/generate_package_config.dart."
],
"configVersion": 2,
- "generated": "2021-12-10T17:31:54.553345",
+ "generated": "2021-12-16T12:51:36.232645",
"generator": "tools/generate_package_config.dart",
"packages": [
{
@@ -372,12 +372,6 @@
"languageVersion": "2.12"
},
{
- "name": "intl",
- "rootUri": "../third_party/pkg/intl",
- "packageUri": "lib/",
- "languageVersion": "2.11"
- },
- {
"name": "js",
"rootUri": "../pkg/js",
"packageUri": "lib/",
@@ -817,4 +811,4 @@
"languageVersion": "2.12"
}
]
-}
\ No newline at end of file
+}
diff --git a/DEPS b/DEPS
index 727fe76..1cb6ae4 100644
--- a/DEPS
+++ b/DEPS
@@ -120,7 +120,6 @@
"http_parser_rev": "202391286ddc13c4c3c284ac5b511f04697250ed",
"http_rev": "f35d1e1467092f6a5edb2abf7071c4a99e8c737a",
"icu_rev" : "81d656878ec611cb0b42d52c82e9dae93920d9ba",
- "intl_tag": "0.17.0-nullsafety",
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
"json_rpc_2_rev": "7e00f893440a72de0637970325e4ea44bd1e8c8e",
"linter_tag": "1.17.1",
@@ -365,8 +364,6 @@
"@" + Var("http_multi_server_rev"),
Var("dart_root") + "/third_party/pkg/http_parser":
Var("dart_git") + "http_parser.git" + "@" + Var("http_parser_rev"),
- Var("dart_root") + "/third_party/pkg/intl":
- Var("dart_git") + "intl.git" + "@" + Var("intl_tag"),
Var("dart_root") + "/third_party/pkg/json_rpc_2":
Var("dart_git") + "json_rpc_2.git" + "@" + Var("json_rpc_2_rev"),
Var("dart_root") + "/third_party/pkg/linter":
diff --git a/pkg/analysis_server/benchmark/benchmarks.dart b/pkg/analysis_server/benchmark/benchmarks.dart
index 78a1b36..7037a85 100644
--- a/pkg/analysis_server/benchmark/benchmarks.dart
+++ b/pkg/analysis_server/benchmark/benchmarks.dart
@@ -10,7 +10,6 @@
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer_utilities/package_root.dart';
import 'package:args/command_runner.dart';
-import 'package:intl/intl.dart';
import 'package:path/path.dart' as path;
import 'perf/benchmarks_impl.dart';
@@ -88,8 +87,6 @@
}
class BenchMarkResult {
- static final NumberFormat nf = NumberFormat.decimalPattern();
-
/// One of 'bytes', 'micros', or 'compound'.
final String kindName;
@@ -104,7 +101,7 @@
Map toJson() => {kindName: value};
@override
- String toString() => '$kindName: ${nf.format(value)}';
+ String toString() => '$kindName: $value';
}
class CompoundBenchMarkResult extends BenchMarkResult {
diff --git a/pkg/analysis_server/lib/src/domain_completion.dart b/pkg/analysis_server/lib/src/domain_completion.dart
index 692b65f..661049b 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -518,8 +518,7 @@
var resolvedUnit = await server.getResolvedUnit(file);
if (resolvedUnit == null) {
- server
- .sendResponse(Response.fileNotAnalyzed(request, 'params.offset'));
+ server.sendResponse(Response.fileNotAnalyzed(request, file));
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart
index 98ac8d5..c571123 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart
@@ -76,26 +76,61 @@
@override
Future<void> compute(ChangeBuilder builder) async {
var constructorName = _constructor.name;
- var requiredParameters = _constructor.parameters
+ var requiredPositionalParameters = _constructor.parameters
.where((parameter) => parameter.isRequiredPositional);
+ var requiredNamedParameters =
+ _constructor.parameters.where((parameter) => parameter.isRequiredNamed);
await builder.addDartFileEdit(file, (builder) {
builder.addInsertion(_targetLocation.offset, (builder) {
- void writeParameters(bool includeType) {
+ void writeParameters(bool isDefinition) {
+ void writeParameter(ParameterElement parameter) {
+ var parameterName = parameter.displayName;
+ var includeType = isDefinition;
+ var includeRequired = isDefinition && parameter.isRequiredNamed;
+ var includeLabel = !isDefinition && parameter.isRequiredNamed;
+
+ if (parameterName.length > 1 && parameterName.startsWith('_')) {
+ parameterName = parameterName.substring(1);
+ }
+ if (includeRequired) {
+ builder.write('required ');
+ }
+ if (includeType && builder.writeType(parameter.type)) {
+ builder.write(' ');
+ }
+ if (includeLabel) {
+ builder.write('$parameterName: ');
+ }
+ builder.write(parameterName);
+ }
+
var firstParameter = true;
- for (var parameter in requiredParameters) {
+ void writeComma() {
if (firstParameter) {
firstParameter = false;
} else {
builder.write(', ');
}
- var parameterName = parameter.displayName;
- if (parameterName.length > 1 && parameterName.startsWith('_')) {
- parameterName = parameterName.substring(1);
+ }
+
+ for (var parameter in requiredPositionalParameters) {
+ writeComma();
+ writeParameter(parameter);
+ }
+ if (requiredNamedParameters.isNotEmpty) {
+ var includeBraces = isDefinition;
+ if (includeBraces) {
+ writeComma();
+ firstParameter = true; // Reset since we just included a comma.
+ builder.write('{');
}
- if (includeType && builder.writeType(parameter.type)) {
- builder.write(' ');
+ for (var parameter in requiredNamedParameters) {
+ writeComma();
+ writeParameter(parameter);
}
- builder.write(parameterName);
+ if (includeBraces) {
+ builder.write('}');
+ }
}
}
diff --git a/pkg/analysis_server/lib/src/status/pages.dart b/pkg/analysis_server/lib/src/status/pages.dart
index e0a24ca..894d446 100644
--- a/pkg/analysis_server/lib/src/status/pages.dart
+++ b/pkg/analysis_server/lib/src/status/pages.dart
@@ -5,15 +5,11 @@
import 'dart:convert';
import 'dart:io';
-import 'package:intl/intl.dart';
-
-final NumberFormat numberFormat = NumberFormat.decimalPattern();
-
String escape(String? text) => text == null ? '' : htmlEscape.convert(text);
-String printInteger(int value) => numberFormat.format(value);
+String printInteger(int value) => '$value';
-String printMilliseconds(num value) => '${numberFormat.format(value)} ms';
+String printMilliseconds(int value) => '$value ms';
String printPercentage(num value, [int fractionDigits = 1]) =>
'${(value * 100).toStringAsFixed(fractionDigits)}%';
diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml
index bb60379..39518e8 100644
--- a/pkg/analysis_server/pubspec.yaml
+++ b/pkg/analysis_server/pubspec.yaml
@@ -20,7 +20,6 @@
dart_style: any
http: any
html: any
- intl: any
linter: any
meta:
path: ../meta
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 5a61202..6095520 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
@@ -104,7 +104,7 @@
''');
}
- Future<void> test_named() async {
+ Future<void> test_namedConstructor() async {
await resolveTestCode('''
class A {
A.named(p1, int p2);
@@ -129,6 +129,56 @@
''');
}
+ Future<void> test_namedOptionalParams() async {
+ await resolveTestCode('''
+class A {
+ A(p1, int p2, List<String> p3, {int? p4});
+}
+class B extends A {
+ int existingField = 0;
+
+ void existingMethod() {}
+}
+''');
+ await assertHasFix('''
+class A {
+ A(p1, int p2, List<String> p3, {int? p4});
+}
+class B extends A {
+ int existingField = 0;
+
+ B(p1, int p2, List<String> p3) : super(p1, p2, p3);
+
+ void existingMethod() {}
+}
+''');
+ }
+
+ Future<void> test_namedRequiredParams() async {
+ await resolveTestCode('''
+class A {
+ A(p1, int p2, List<String> p3, {required int p4, required int p5});
+}
+class B extends A {
+ int existingField = 0;
+
+ void existingMethod() {}
+}
+''');
+ await assertHasFix('''
+class A {
+ A(p1, int p2, List<String> p3, {required int p4, required int p5});
+}
+class B extends A {
+ int existingField = 0;
+
+ B(p1, int p2, List<String> p3, {required int p4, required int p5}) : super(p1, p2, p3, p4: p4, p5: p5);
+
+ void existingMethod() {}
+}
+''');
+ }
+
Future<void> test_optional() async {
await resolveTestCode('''
class A {
diff --git a/pkg/dartdev/lib/src/commands/fix.dart b/pkg/dartdev/lib/src/commands/fix.dart
index d6c8b5a..f8659f6 100644
--- a/pkg/dartdev/lib/src/commands/fix.dart
+++ b/pkg/dartdev/lib/src/commands/fix.dart
@@ -6,7 +6,6 @@
import 'dart:io' as io;
import 'package:analysis_server_client/protocol.dart' hide AnalysisError;
-import 'package:intl/intl.dart';
import 'package:meta/meta.dart';
import 'package:path/path.dart' as path;
@@ -18,8 +17,6 @@
class FixCommand extends DartdevCommand {
static const String cmdName = 'fix';
- static final NumberFormat _numberFormat = NumberFormat.decimalPattern();
-
static const String cmdDescription =
'''Apply automated fixes to Dart source code.
@@ -344,7 +341,7 @@
}
}
- static String _format(int value) => _numberFormat.format(value);
+ static String _format(int value) => '$value';
}
/// The result of running tests in a given directory.
diff --git a/pkg/dartdev/pubspec.yaml b/pkg/dartdev/pubspec.yaml
index aa4f922..9d78178 100644
--- a/pkg/dartdev/pubspec.yaml
+++ b/pkg/dartdev/pubspec.yaml
@@ -23,7 +23,6 @@
devtools_server: any
front_end:
path: ../front_end
- intl: any
meta:
path: ../meta
nnbd_migration:
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index b1377c6..521d5ab 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -557,6 +557,15 @@
return _packages = await createPackagesFromFile(_raw.packagesFileUri!);
}
+ if (inputs.isEmpty) {
+ return _packages = PackageConfig.empty;
+ }
+
+ // When compiling the SDK the input files are normally `dart:` URIs.
+ if (inputs.every((uri) => uri.scheme == 'dart')) {
+ return _packages = PackageConfig.empty;
+ }
+
if (inputs.length > 1) {
// TODO(sigmund): consider not reporting an error if we would infer
// the same .packages file from all of the inputs.
@@ -564,15 +573,9 @@
messageCantInferPackagesFromManyInputs, Severity.error);
return _packages = PackageConfig.empty;
}
- if (inputs.isEmpty) {
- return _packages = PackageConfig.empty;
- }
Uri input = inputs.first;
- // When compiling the SDK the input files are normally `dart:` URIs.
- if (input.scheme == 'dart') return _packages = PackageConfig.empty;
-
if (input.scheme == 'packages') {
report(
messageCantInferPackagesFromPackageUri.withLocation(
@@ -581,7 +584,7 @@
return _packages = PackageConfig.empty;
}
- return _packages = await _findPackages(inputs.first);
+ return _packages = await _findPackages(input);
}
Future<Uint8List?> _readFile(Uri uri, bool reportError) async {
diff --git a/pkg/front_end/tool/_fasta/command_line.dart b/pkg/front_end/tool/_fasta/command_line.dart
index 0c8312e..58d7517 100644
--- a/pkg/front_end/tool/_fasta/command_line.dart
+++ b/pkg/front_end/tool/_fasta/command_line.dart
@@ -277,7 +277,7 @@
..sdkSummary = Options.platform.read(parsedOptions)
..librariesSpecificationUri = resolveInputUri(arguments[1])
..setExitCodeOnProblem = true,
- inputs: <Uri>[Uri.parse(arguments[0])],
+ inputs: arguments[0].split(',').map(Uri.parse).toList(),
output: resolveInputUri(arguments[3]));
} else if (arguments.isEmpty) {
return throw new CommandLineProblem.deprecated("No Dart file specified.");
diff --git a/pkg/front_end/tool/_fasta/compile_platform_legacy_test.dart b/pkg/front_end/tool/_fasta/compile_platform_legacy_test.dart
index 073dd5f..b7b6fa6 100644
--- a/pkg/front_end/tool/_fasta/compile_platform_legacy_test.dart
+++ b/pkg/front_end/tool/_fasta/compile_platform_legacy_test.dart
@@ -36,6 +36,30 @@
Expect.isTrue(await new File.fromUri(outlineDill).exists());
});
});
+
+ asyncTest(() async {
+ await withTemporaryDirectory("compile_platform_test_", (Uri tmp) async {
+ Uri platformDill = tmp.resolve("dart2js_platform.dill");
+ Uri outlineDill = tmp.resolve("dart2js_outline.dill");
+ ProcessResult result = await Process.run(dartVm.toFilePath(), <String>[
+ compilePlatform.toFilePath(),
+ "--target=dart2js",
+ "--no-deps",
+ "-v",
+ "dart:core,dart:js_util",
+ librariesJson.toFilePath(),
+ outlineDill.toFilePath(),
+ platformDill.toFilePath(),
+ outlineDill.toFilePath(),
+ ]);
+ stdout.write(result.stdout);
+ stderr.write(result.stderr);
+ Expect.equals(
+ 0, result.exitCode, "Non-zero exitcode from compile_platform.dart");
+ Expect.isTrue(await new File.fromUri(platformDill).exists());
+ Expect.isTrue(await new File.fromUri(outlineDill).exists());
+ });
+ });
}
Future<void> withTemporaryDirectory(
diff --git a/pkg/front_end/tool/_fasta/compile_platform_test.dart b/pkg/front_end/tool/_fasta/compile_platform_test.dart
index 073dd5f..b7b6fa6 100644
--- a/pkg/front_end/tool/_fasta/compile_platform_test.dart
+++ b/pkg/front_end/tool/_fasta/compile_platform_test.dart
@@ -36,6 +36,30 @@
Expect.isTrue(await new File.fromUri(outlineDill).exists());
});
});
+
+ asyncTest(() async {
+ await withTemporaryDirectory("compile_platform_test_", (Uri tmp) async {
+ Uri platformDill = tmp.resolve("dart2js_platform.dill");
+ Uri outlineDill = tmp.resolve("dart2js_outline.dill");
+ ProcessResult result = await Process.run(dartVm.toFilePath(), <String>[
+ compilePlatform.toFilePath(),
+ "--target=dart2js",
+ "--no-deps",
+ "-v",
+ "dart:core,dart:js_util",
+ librariesJson.toFilePath(),
+ outlineDill.toFilePath(),
+ platformDill.toFilePath(),
+ outlineDill.toFilePath(),
+ ]);
+ stdout.write(result.stdout);
+ stderr.write(result.stderr);
+ Expect.equals(
+ 0, result.exitCode, "Non-zero exitcode from compile_platform.dart");
+ Expect.isTrue(await new File.fromUri(platformDill).exists());
+ Expect.isTrue(await new File.fromUri(outlineDill).exists());
+ });
+ });
}
Future<void> withTemporaryDirectory(
diff --git a/sdk/lib/async/broadcast_stream_controller.dart b/sdk/lib/async/broadcast_stream_controller.dart
index c2db270..bed1f7d 100644
--- a/sdk/lib/async/broadcast_stream_controller.dart
+++ b/sdk/lib/async/broadcast_stream_controller.dart
@@ -254,7 +254,6 @@
} else {
stackTrace ??= AsyncError.defaultStackTrace(error);
}
- if (stackTrace == null) throw "unreachable"; // TODO(40088)
_sendError(error, stackTrace);
}
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index 2283ba7..ea6c234 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -1097,7 +1097,6 @@
} else {
stackTrace ??= AsyncError.defaultStackTrace(error);
}
- if (stackTrace == null) throw "unreachable"; // TODO(40088).
result._completeError(error, stackTrace);
}
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index 52664b3..c3dc65b 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -29,7 +29,6 @@
} else {
stackTrace ??= AsyncError.defaultStackTrace(error);
}
- if (stackTrace == null) throw "unreachable"; // TODO(40088)
_completeError(error, stackTrace);
}
diff --git a/sdk/lib/async/stream_controller.dart b/sdk/lib/async/stream_controller.dart
index 7121af8..6a21c59 100644
--- a/sdk/lib/async/stream_controller.dart
+++ b/sdk/lib/async/stream_controller.dart
@@ -565,7 +565,6 @@
} else {
stackTrace ??= AsyncError.defaultStackTrace(error);
}
- if (stackTrace == null) throw "unreachable"; // TODO(40088)
_addError(error, stackTrace);
}
diff --git a/tools/VERSION b/tools/VERSION
index 53d046d..5031272 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 16
PATCH 0
-PRERELEASE 125
+PRERELEASE 126
PRERELEASE_PATCH 0
\ No newline at end of file