Version 2.15.0-121.0.dev
Merge commit '81dda21cd4d20b24a15ebda06b36c104a085579b' into 'dev'
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index a0caf52..78e7fc4e 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -284,9 +284,8 @@
verifier.generateDuplicateShownHiddenNameHints(errorReporter);
verifier.generateUnusedImportHints(errorReporter);
verifier.generateUnusedShownNameHints(errorReporter);
- // TODO(srawlins): Re-enable this check once Flutter engine path is clear.
- // verifier.generateUnnecessaryImportHints(
- // errorReporter, _usedImportedElementsList);
+ verifier.generateUnnecessaryImportHints(
+ errorReporter, _usedImportedElementsList);
}
// Unused local elements.
diff --git a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
index 0e1d054..fbfbc17 100644
--- a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
+++ b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
@@ -469,8 +469,7 @@
_reportErrorIfFromDeferredLibrary(
realArgument,
CompileTimeErrorCode
- .INVALID_ANNOTATION_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY,
- [realArgument]);
+ .INVALID_ANNOTATION_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY);
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
index d25fcf6..379b087 100644
--- a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
@@ -1280,7 +1280,7 @@
// to be a DynamicTypeImpl
Identifier name = typeName.name;
if (!_libraryElement.shouldIgnoreUndefinedIdentifier(name)) {
- _errorReporter.reportErrorForNode(errorCode, name, [name.name]);
+ _errorReporter.reportErrorForNode(errorCode, name);
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart
index 2a71f1d..fc870ea 100644
--- a/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart
@@ -112,8 +112,10 @@
}
CompileTimeErrorCode errorCode;
+ List<String> arguments;
if (parentExpression == null) {
errorCode = CompileTimeErrorCode.UNCHECKED_INVOCATION_OF_NULLABLE_VALUE;
+ arguments = [];
} else {
if (parentExpression is CascadeExpression) {
parentExpression = parentExpression.cascadeSections.first;
@@ -121,16 +123,20 @@
if (parentExpression is BinaryExpression) {
errorCode = CompileTimeErrorCode
.UNCHECKED_OPERATOR_INVOCATION_OF_NULLABLE_VALUE;
+ arguments = [name];
} else if (parentExpression is MethodInvocation ||
parentExpression is MethodReferenceExpression) {
errorCode = CompileTimeErrorCode
.UNCHECKED_METHOD_INVOCATION_OF_NULLABLE_VALUE;
+ arguments = [name];
} else if (parentExpression is FunctionExpressionInvocation) {
errorCode =
CompileTimeErrorCode.UNCHECKED_INVOCATION_OF_NULLABLE_VALUE;
+ arguments = [];
} else {
errorCode =
CompileTimeErrorCode.UNCHECKED_PROPERTY_ACCESS_OF_NULLABLE_VALUE;
+ arguments = [name];
}
}
@@ -150,7 +156,7 @@
}
_resolver.nullableDereferenceVerifier.report(
errorCode, propertyErrorEntity, receiverType,
- arguments: [name], messages: messages);
+ arguments: arguments, messages: messages);
_reportedGetterError = true;
_reportedSetterError = true;
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index eac31f6..53d62f5 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -1227,9 +1227,7 @@
prefix.name, FunctionElement.LOAD_LIBRARY_NAME);
if (loadLibraryElement != null) {
_errorReporter.reportErrorForNode(
- HintCode.IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION,
- node,
- [importedLibrary.name]);
+ HintCode.IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION, node);
return true;
}
return false;
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index c5f54b2..2974e8f 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -6978,7 +6978,7 @@
// ```
static const CompileTimeErrorCode INVALID_MODIFIER_ON_SETTER =
CompileTimeErrorCode('INVALID_MODIFIER_ON_SETTER',
- "The modifier '{0}' can't be applied to the body of a setter.",
+ "Setters can't use 'async', 'async*', or 'sync*'.",
correction: "Try removing the modifier.", hasPublishedDocs: true);
/**
diff --git a/pkg/analyzer/lib/src/error/imports_verifier.dart b/pkg/analyzer/lib/src/error/imports_verifier.dart
index 4568292..878fdee 100644
--- a/pkg/analyzer/lib/src/error/imports_verifier.dart
+++ b/pkg/analyzer/lib/src/error/imports_verifier.dart
@@ -339,8 +339,7 @@
int length = identifiers.length;
for (int i = 0; i < length; i++) {
Identifier identifier = identifiers[i];
- reporter.reportErrorForNode(
- HintCode.DUPLICATE_HIDDEN_NAME, identifier, [identifier.name]);
+ reporter.reportErrorForNode(HintCode.DUPLICATE_HIDDEN_NAME, identifier);
}
});
_duplicateShownNamesMap.forEach(
@@ -348,8 +347,7 @@
int length = identifiers.length;
for (int i = 0; i < length; i++) {
Identifier identifier = identifiers[i];
- reporter.reportErrorForNode(
- HintCode.DUPLICATE_SHOWN_NAME, identifier, [identifier.name]);
+ reporter.reportErrorForNode(HintCode.DUPLICATE_SHOWN_NAME, identifier);
}
});
}
diff --git a/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart b/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
index 35834b5..4a5d28e 100644
--- a/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
+++ b/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
@@ -47,6 +47,7 @@
List<DiagnosticMessage>? messages}) {
if (receiverType == _typeSystem.typeProvider.nullType) {
errorCode = CompileTimeErrorCode.INVALID_USE_OF_NULL_VALUE;
+ arguments = [];
}
if (errorEntity is AstNode) {
_errorReporter.reportErrorForNode(
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index bf8620e..73d7faf 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -1987,9 +1987,7 @@
ConstructorName constructorName, TypeName typeName) {
if (typeName.isDeferred) {
errorReporter.reportErrorForNode(
- CompileTimeErrorCode.CONST_DEFERRED_CLASS,
- constructorName,
- [typeName.name.name]);
+ CompileTimeErrorCode.CONST_DEFERRED_CLASS, constructorName);
}
}
@@ -2526,9 +2524,7 @@
DartType type = node.typeOrThrow;
if (type is FunctionType && type.typeFormals.isNotEmpty) {
errorReporter.reportErrorForNode(
- CompileTimeErrorCode.GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND,
- node,
- [type]);
+ CompileTimeErrorCode.GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND, node);
}
}
diff --git a/pkg/analyzer/test/source/error_processor_test.dart b/pkg/analyzer/test/source/error_processor_test.dart
index d9a581f..c9ec408 100644
--- a/pkg/analyzer/test/source/error_processor_test.dart
+++ b/pkg/analyzer/test/source/error_processor_test.dart
@@ -37,9 +37,7 @@
]);
AnalysisError use_of_void_result = AnalysisError(
- TestSource(), 0, 1, CompileTimeErrorCode.USE_OF_VOID_RESULT, [
- ['x']
- ]);
+ TestSource(), 0, 1, CompileTimeErrorCode.USE_OF_VOID_RESULT, []);
// We in-line a lint code here in order to avoid adding a dependency on the
// linter package.
diff --git a/pkg/analyzer/test/src/diagnostics/unnecessary_import_test.dart b/pkg/analyzer/test/src/diagnostics/unnecessary_import_test.dart
index a5c76d1..b6071fc 100644
--- a/pkg/analyzer/test/src/diagnostics/unnecessary_import_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unnecessary_import_test.dart
@@ -9,8 +9,7 @@
main() {
defineReflectiveSuite(() {
- // TODO(srawlins): Re-enable this check once Flutter engine path is clear.
- // defineReflectiveTests(UnnecessaryImportTest);
+ defineReflectiveTests(UnnecessaryImportTest);
});
}
diff --git a/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_test.dart b/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_test.dart
index ab55baf..e132fd9 100644
--- a/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unnecessary_type_check_test.dart
@@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:analyzer/src/dart/error/hint_codes.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index e13b744..da67bc4 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -6713,7 +6713,7 @@
### invalid_modifier_on_setter
-_The modifier '{0}' can't be applied to the body of a setter._
+_Setters can't use 'async', 'async*', or 'sync*'._
#### Description
diff --git a/pkg/dartdev/lib/dartdev.dart b/pkg/dartdev/lib/dartdev.dart
index c50d7d0..151bf0a 100644
--- a/pkg/dartdev/lib/dartdev.dart
+++ b/pkg/dartdev/lib/dartdev.dart
@@ -10,20 +10,20 @@
import 'package:args/command_runner.dart';
import 'package:cli_util/cli_logging.dart';
import 'package:dart_style/src/cli/format_command.dart';
-import 'package:dartdev/src/commands/migrate.dart';
import 'package:devtools_server/devtools_server.dart';
import 'package:meta/meta.dart';
import 'package:pedantic/pedantic.dart';
import 'package:pub/pub.dart';
-
import 'package:usage/usage.dart';
import 'src/analytics.dart';
import 'src/commands/analyze.dart';
import 'src/commands/compile.dart';
import 'src/commands/create.dart';
+import 'src/commands/debug_adapter.dart';
import 'src/commands/fix.dart';
import 'src/commands/language_server.dart';
+import 'src/commands/migrate.dart';
import 'src/commands/run.dart';
import 'src/commands/test.dart';
import 'src/core.dart';
@@ -112,6 +112,7 @@
addCommand(AnalyzeCommand(verbose: verbose));
addCommand(CreateCommand(verbose: verbose));
+ addCommand(DebugAdapterCommand(verbose: verbose));
addCommand(CompileCommand(verbose: verbose));
addCommand(DevToolsCommand(
verbose: verbose,
diff --git a/pkg/dartdev/lib/src/commands/debug_adapter.dart b/pkg/dartdev/lib/src/commands/debug_adapter.dart
new file mode 100644
index 0000000..e1a87b5
--- /dev/null
+++ b/pkg/dartdev/lib/src/commands/debug_adapter.dart
@@ -0,0 +1,72 @@
+// 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 'dart:async';
+import 'dart:io';
+
+import 'package:dds/dap.dart';
+
+import '../core.dart';
+
+/// A command to start a debug adapter process that communicates over
+/// stdin/stdout using the Debug Adapter Protocol to allow editors to run debug
+/// sessions in a standard way.
+class DebugAdapterCommand extends DartdevCommand {
+ static const String cmdName = 'debug_adapter';
+
+ static const argIpv6 = 'ipv6';
+ static const argDds = 'dds';
+ static const argAuthCodes = 'auth-codes';
+ static const argTest = 'test';
+
+ DebugAdapterCommand({bool verbose = false})
+ : super(
+ cmdName,
+ 'Start a debug adapter that conforms to the Debug Adapter Protocol.',
+ verbose,
+ hidden: true,
+ ) {
+ argParser
+ ..addFlag(
+ argIpv6,
+ defaultsTo: false,
+ help: 'Whether to bind DAP/VM Service/DDS to IPv6 addresses.',
+ )
+ ..addFlag(
+ argDds,
+ defaultsTo: true,
+ help: 'Whether to enable DDS for debug sessions.',
+ )
+ ..addFlag(
+ argAuthCodes,
+ defaultsTo: true,
+ help: 'Whether to enable authentication codes for VM Services.',
+ )
+ ..addFlag(
+ argTest,
+ defaultsTo: false,
+ help: 'Whether to use the "dart test" debug adapter to run tests'
+ ' and emit custom events for test progress/results.',
+ );
+ }
+
+ @override
+ FutureOr<int> run() async {
+ final args = argResults;
+ final ipv6 = args[argIpv6] as bool;
+
+ final server = DapServer(
+ stdin,
+ stdout.nonBlocking,
+ ipv6: ipv6,
+ enableDds: args[argDds],
+ enableAuthCodes: args[argAuthCodes],
+ test: args[argTest],
+ );
+
+ await server.channel.closed;
+
+ return 0;
+ }
+}
diff --git a/pkg/dartdev/pubspec.yaml b/pkg/dartdev/pubspec.yaml
index 5f509c2..fb3e6d0 100644
--- a/pkg/dartdev/pubspec.yaml
+++ b/pkg/dartdev/pubspec.yaml
@@ -17,6 +17,8 @@
dart2native:
path: ../dart2native
dart_style: any
+ dds:
+ path: ../dds
devtools_server: any
front_end:
path: ../front_end
diff --git a/pkg/dartdev/test/commands/debug_adapter_test.dart b/pkg/dartdev/test/commands/debug_adapter_test.dart
new file mode 100644
index 0000000..c21f476
--- /dev/null
+++ b/pkg/dartdev/test/commands/debug_adapter_test.dart
@@ -0,0 +1,29 @@
+// 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:test/test.dart';
+
+import '../utils.dart';
+
+void main() {
+ group('debug_adapter', debugAdapter, timeout: longTimeout);
+}
+
+void debugAdapter() {
+ // Implementation of debug_adapter is tested in the DDS package where the
+ // DAP implementation lives.
+ test('--help', () {
+ final p = project();
+ var result = p.runSync(['debug_adapter', '--help']);
+
+ expect(
+ result.stdout,
+ contains(
+ 'Start a debug adapter that conforms to the Debug Adapter Protocol.'));
+ expect(result.stdout,
+ contains('Whether to use the "dart test" debug adapter to run tests'));
+ expect(result.stderr, isEmpty);
+ expect(result.exitCode, 0);
+ });
+}
diff --git a/pkg/dds/lib/dap.dart b/pkg/dds/lib/dap.dart
new file mode 100644
index 0000000..cb598fe
--- /dev/null
+++ b/pkg/dds/lib/dap.dart
@@ -0,0 +1,5 @@
+// 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.
+
+export 'src/dap/server.dart' show DapServer;
diff --git a/pkg/dds/test/dap/integration/test_client.dart b/pkg/dds/test/dap/integration/test_client.dart
index f794ad7..0850b5c4 100644
--- a/pkg/dds/test/dap/integration/test_client.dart
+++ b/pkg/dds/test/dap/integration/test_client.dart
@@ -26,7 +26,7 @@
final Logger? _logger;
final bool captureVmServiceTraffic;
- final _requestWarningDuration = const Duration(seconds: 5);
+ final _requestWarningDuration = const Duration(seconds: 10);
final Map<int, _OutgoingRequest> _pendingRequests = {};
final _eventController = StreamController<Event>.broadcast();
int _seq = 1;
diff --git a/pkg/dds/test/dap/integration/test_server.dart b/pkg/dds/test/dap/integration/test_server.dart
index 41ea32e..ccb4c1d 100644
--- a/pkg/dds/test/dap/integration/test_server.dart
+++ b/pkg/dds/test/dap/integration/test_server.dart
@@ -12,6 +12,9 @@
import 'package:path/path.dart' as path;
import 'package:pedantic/pedantic.dart';
+/// Enable to run from local source (useful in development).
+const runFromSource = false;
+
abstract class DapTestServer {
Future<void> stop();
StreamSink<List<int>> get sink;
@@ -102,13 +105,18 @@
final ddsEntryScript =
await Isolate.resolvePackageUri(Uri.parse('package:dds/dds.dart'));
final ddsLibFolder = path.dirname(ddsEntryScript!.toFilePath());
- final dapServerScript =
- path.join(ddsLibFolder, '../tool/dap/run_server.dart');
+ final dartdevScript = path
+ .normalize(path.join(ddsLibFolder, '../../dartdev/bin/dartdev.dart'));
- final _process = await Process.start(
- Platform.resolvedExecutable,
- [dapServerScript, 'dap', ...?additionalArgs],
- );
+ final args = [
+ // When running from source, run the script instead of directly using
+ // the "dart debug_adapter" command.
+ if (runFromSource) dartdevScript,
+ 'debug_adapter',
+ ...?additionalArgs,
+ ];
+
+ final _process = await Process.start(Platform.resolvedExecutable, args);
return OutOfProcessDapTestServer._(_process, logger);
}
diff --git a/pkg/dds/tool/dap/run_server.dart b/pkg/dds/tool/dap/run_server.dart
deleted file mode 100644
index 6130640..0000000
--- a/pkg/dds/tool/dap/run_server.dart
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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 'dart:async';
-import 'dart:io';
-
-import 'package:args/command_runner.dart';
-import 'package:dds/src/dap/server.dart';
-
-Future<void> main(List<String> arguments) async {
- // TODO(dantup): "dap_tool" is a placeholder and will likely eventually be a
- // "dart" command.
- final runner = CommandRunner('dap_tool', 'Dart DAP Tool')
- ..addCommand(DapCommand(stdin, stdout.nonBlocking));
-
- try {
- await runner.run(arguments);
- } on UsageException catch (e) {
- print(e);
- exit(64);
- }
-}
-
-class DapCommand extends Command {
- static const argIpv6 = 'ipv6';
- static const argDds = 'dds';
- static const argAuthCodes = 'auth-codes';
- static const argTest = 'test';
-
- final Stream<List<int>> _inputStream;
- final StreamSink<List<int>> _outputSink;
-
- @override
- final String description = 'Start a DAP debug server.';
-
- @override
- final String name = 'dap';
-
- DapCommand(this._inputStream, this._outputSink) {
- argParser
- ..addFlag(
- argIpv6,
- defaultsTo: false,
- help: 'Whether to bind DAP/VM Service/DDS to IPv6 addresses',
- )
- ..addFlag(
- argDds,
- defaultsTo: true,
- help: 'Whether to enable DDS for debug sessions',
- )
- ..addFlag(
- argAuthCodes,
- defaultsTo: true,
- help: 'Whether to enable authentication codes for VM Services',
- )
- ..addFlag(
- argTest,
- defaultsTo: false,
- help: 'Whether to use the "dart test" debug adapter to run tests'
- ' and emit custom events for test progress',
- );
- }
-
- Future<void> run() async {
- final args = argResults!;
- final ipv6 = args[argIpv6] as bool;
-
- final server = DapServer(
- _inputStream,
- _outputSink,
- ipv6: ipv6,
- enableDds: args[argDds],
- enableAuthCodes: args[argAuthCodes],
- test: args[argTest],
- );
-
- await server.channel.closed;
- }
-}
diff --git a/tools/VERSION b/tools/VERSION
index 10235e0..f1f0b56 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 120
+PRERELEASE 121
PRERELEASE_PATCH 0
\ No newline at end of file