diff --git a/pkg/analysis_server/doc/process/new_language_feature.md b/pkg/analysis_server/doc/process/new_language_feature.md index ef8c83ddfcfa..44f531933528 100644 --- a/pkg/analysis_server/doc/process/new_language_feature.md +++ b/pkg/analysis_server/doc/process/new_language_feature.md @@ -18,41 +18,68 @@ Separate issues should be created for each of the items in the list. The following is a list of the individual features that need to be considered. The features are listed in alphabetical order. -- [ ] Call Hierarchy -- [ ] Closing Labels +- [ ] Call Hierarchy (an IDE feature where you can get a call hierarchy if you + click on a method) +- [ ] Closing Labels (an LSP feature allowing the IDE to show lightly grayed out + comments at the end of the last line of a multi-line invocation, to aid + the user in understanding what invocation is closed by a `)`) - [ ] Code Completion - [ ] Code Folding -- [ ] Document Symbols -- [ ] Document Colors -- [ ] Flutter Outline +- [ ] Document Colors (an LSP feature whereby a reference to a color in code can + be associated with a colored swatch and a color picker) - [ ] Hovers -- [ ] Implemented Markers -- [ ] Inlay Hints -- [ ] Navigation - legacy -- [ ] Navigation - LSP Go to Definition -- [ ] Navigation - LSP Go to Type Definition -- [ ] Navigation - Go to Super -- [ ] Occurrences - legacy -- [ ] Occurrences - LSP Document Highlights +- Implemented/override markers (a legacy protocol feature, only available to + IntelliJ and Android Studio) + - [ ] Implemented Markers (allows navigation from a base class method to + methods that override it, or from a base class to classes that + extend/implement it) + - [ ] Override Markers (allows navigation from a method to the base class + method it overrides, or from a class to the class that it + extends/implements) +- [ ] Inlay Hints (an LSP feature allowing extra information to be displayed + using inline hints) +- Navigation + - [ ] Go to Definition (LSP feature) + - [ ] Go to Type Definition (LSP feature) + - [ ] Go to Super (LSP feature) + - [ ] Legacy protocol (for IntelliJ and Android Studio) +- Occurrences + - [ ] Legacy protocol (for IntelliJ and Android Studio) + - [ ] Document Highlights (LSP feature) - [ ] Organize Imports -- [ ] Outline -- [ ] Overrides Markers -- [ ] Quick Assists -- [ ] Quick Fixes -- [ ] Refactorings - legacy -- [ ] Refactorings - self describing -- [ ] Search - Find References -- [ ] Search - Implementations - LSP -- [ ] Search - Member Declarations -- [ ] Search - Member References -- [ ] Search - Top-level Declarations -- [ ] Selection Range +- Outline + - [ ] Flutter Outline + - [ ] Legacy protocol, a.k.a. Document Symbols (for IntelliJ and Android + Studio) + - [ ] LSP feature +- Refactorings and quick assists/fixes (note that in addition to potentially + creating new refactorings and/or quick assists/fixes, part of the work + required to implement a new language feature includes evaluating each existing + refactoring and quick fix/assist to see whether it needs to be improved or + have test cases added to reflect the new feature). + - [ ] Legacy refactorings (for IntelliJ and Android Studio) + - [ ] LSP rename refactoring (note that LSP has a special protocol for + renames) + - [ ] LSP self-describing refactorings + - [ ] Quick Assists + - [ ] Quick Fixes +- Search + - [ ] Find References + - [ ] Implementations - LSP + - [ ] Member Declarations + - [ ] Member References + - [ ] Top-level Declarations +- [ ] Selection Range (an LSP feature allowing a selection to be expanded to + cover the range of an ancestor AST node) - Syntax Highlighting - - [ ] Semantic Highlights - - [ ] LSP Semantic Tokens -- [ ] Signature Help + - [ ] Legacy protocol, a.k.a. Semantic Highlights (for IntelliJ and Android + Studio) + - [ ] Semantic Tokens (LSP feature) +- [ ] Signature Help (an LSP feature that tells the parameters and types needed + for an invocation) - [ ] Snippets - [ ] Sort Members -- [ ] Type Hierarchy - legacy -- [ ] Type Hierarchy - LSP -- [ ] Workspace Symbols +- Type Hierarchy + - [ ] Legacy protocol (for IntelliJ and Android Studio) + - [ ] LSP feature +- [ ] Workspace Symbols (LSP feature) diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml index ffe813f70222..31e6ffa1abff 100644 --- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml +++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml @@ -45,8 +45,8 @@ # # Stats: # - 42 "needsEvaluation" -# - 346 "needsFix" -# - 405 "hasFix" +# - 345 "needsFix" +# - 406 "hasFix" # - 516 "noFix" AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR: @@ -2590,9 +2590,7 @@ ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY: ParserErrorCode.CONST_FACTORY: status: hasFix ParserErrorCode.CONST_METHOD: - status: needsFix - notes: |- - Remove the `const` keyword. + status: hasFix ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE: status: needsFix notes: |- diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart index 67975fa983fb..632db5a11a95 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart @@ -1360,6 +1360,9 @@ final _builtInNonLintProducers = >{ ParserErrorCode.CONST_FACTORY: [ RemoveConst.new, ], + ParserErrorCode.CONST_METHOD: [ + RemoveConst.new, + ], ParserErrorCode.DEFAULT_IN_SWITCH_EXPRESSION: [ ReplaceWithWildcard.new, ], diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart index f412204ef71e..b3127b5cc79b 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart @@ -140,6 +140,15 @@ mixin class A {} '''); } + Future test_constMethod() async { + await resolveTestCode(''' +const void m() {} +'''); + await assertHasFix(''' +void m() {} +'''); + } + Future test_covariantTopLevelDeclaration_class() async { await resolveTestCode(r''' covariant class C {} diff --git a/pkg/analyzer/tool/messages/generate.dart b/pkg/analyzer/tool/messages/generate.dart index 484650bcc843..ddf6063ef615 100644 --- a/pkg/analyzer/tool/messages/generate.dart +++ b/pkg/analyzer/tool/messages/generate.dart @@ -313,8 +313,8 @@ class _SyntacticErrorGenerator { } // Print the # of autogenerated ParserErrorCodes. - print('${cfeToAnalyzerErrorCodeTables.infoToAnalyzerCode.length} of ' - '${messageToName.length} ParserErrorCodes generated.'); + print('${messageToName.length} of ' + '${cfeToAnalyzerErrorCodeTables.infoToAnalyzerCode.length} ParserErrorCodes generated.'); // List the ParserErrorCodes that could easily be auto generated // but have not been already. diff --git a/pkg/front_end/test/coverage_suite.dart b/pkg/front_end/test/coverage_suite.dart index f36da0cdcc20..db241fa8fb0f 100644 --- a/pkg/front_end/test/coverage_suite.dart +++ b/pkg/front_end/test/coverage_suite.dart @@ -381,9 +381,12 @@ Future _run(Directory coverageTmpDir, List arguments) async { })); } - if (options.verbose) { + if (options.verbose || log != null) { String result = pass ? "PASS" : "FAIL"; print("${testName}: ${result}"); + if (log != null) { + print(" ${log.replaceAll('\n', '\n ')}"); + } } } @@ -393,6 +396,7 @@ Future _run(Directory coverageTmpDir, List arguments) async { // TODO(jensj): More info here would be good. addResult(coverageEntry.key.toString(), false, log: "Error"); } else { + StringBuffer sb = new StringBuffer(); int hitCount = coverageEntry.value.hitCount; int missCount = coverageEntry.value.missCount; double percent = (hitCount / (hitCount + missCount) * 100); @@ -402,13 +406,24 @@ Future _run(Directory coverageTmpDir, List arguments) async { int requireAtLeast = (_expect[coverageEntry.key.toString()] ?? 0.0).floor(); bool pass = percent >= requireAtLeast; - String? log; if (!pass) { - log = "${coverageEntry.value.visualization}\n\n" - "Expected at least $requireAtLeast%, got $percent% " - "($hitCount hits and $missCount misses)."; + sb.write("${coverageEntry.value.visualization}"); + sb.write("\n\nExpected at least $requireAtLeast%, got $percent% " + "($hitCount hits and $missCount misses)."); + sb.write("\n\nTo re-run this test, run:"); + var extraFlags = _assertsEnabled ? ' --enable-asserts' : ''; + // It looks like coverage results vary slightly based on the number of + // tasks, so include a `--tasks=` argument in the repro instructions. + // + // TODO(paulberry): why do coverage results vary based on the number of + // tasks? (Note: possibly due to + // https://github.com/dart-lang/sdk/issues/42061) + sb.write( + "\n\n dart$extraFlags pkg/front_end/test/coverage_suite.dart " + "--tasks=${options.numberOfWorkers}"); } - addResult(coverageEntry.key.toString(), pass, log: log); + addResult(coverageEntry.key.toString(), pass, + log: sb.isEmpty ? null : sb.toString()); } } @@ -507,3 +522,9 @@ class Options { ); } } + +final bool _assertsEnabled = () { + bool assertsEnabled = false; + assert(assertsEnabled = true); + return assertsEnabled; +}(); diff --git a/runtime/vm/object.h b/runtime/vm/object.h index f36c5f109d5f..56fdb18e38c6 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h @@ -6070,8 +6070,6 @@ class PcDescriptors : public Object { // Verify (assert) assumptions about pc descriptors in debug mode. void Verify(const Function& function) const; - static void PrintHeaderString(); - void PrintToJSONObject(JSONObject* jsobj, bool ref) const; // We would have a VisitPointers function here to traverse the @@ -10842,22 +10840,27 @@ class Array : public Instance { template ObjectPtr At(intptr_t index) const { + ASSERT((0 <= index) && (index < Length())); return untag()->element(index); } template void SetAt(intptr_t index, const Object& value) const { + ASSERT((0 <= index) && (index < Length())); untag()->set_element(index, value.ptr()); } template void SetAt(intptr_t index, const Object& value, Thread* thread) const { + ASSERT((0 <= index) && (index < Length())); untag()->set_element(index, value.ptr(), thread); } // Access to the array with acquire release semantics. ObjectPtr AtAcquire(intptr_t index) const { + ASSERT((0 <= index) && (index < Length())); return untag()->element(index); } void SetAtRelease(intptr_t index, const Object& value) const { + ASSERT((0 <= index) && (index < Length())); untag()->set_element(index, value.ptr()); } diff --git a/third_party/pkg/dap/CHANGELOG.md b/third_party/pkg/dap/CHANGELOG.md index 42c1adcaee20..dd201e532818 100644 --- a/third_party/pkg/dap/CHANGELOG.md +++ b/third_party/pkg/dap/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.3.0 + +- Add `showToUser` field to `DebugAdapterException` to specify which errors should be shown to users. + ## 1.2.0 - Added `DartInitializeRequestArguments`, a subclass of `InitializeRequestArguments` that supports a custom flag `supportsDartUris` for informing the debug adapter that the client supports using URIs in places that might usually be file paths (such as `stackTraceRequest`). Setting this flag indicates that the client supports `file:` URIs _and also_ any custom-scheme URIs whose content can be provided by the analysis server from the matching Dart SDK. diff --git a/third_party/pkg/dap/lib/src/exceptions.dart b/third_party/pkg/dap/lib/src/exceptions.dart index 5e039c740797..becb265f649a 100644 --- a/third_party/pkg/dap/lib/src/exceptions.dart +++ b/third_party/pkg/dap/lib/src/exceptions.dart @@ -8,7 +8,10 @@ class DebugAdapterException implements Exception { final String message; - DebugAdapterException(this.message); + /// Whether or not to show the error to the user as a notification. + final bool showToUser; + + DebugAdapterException(this.message, {this.showToUser = false}); @override String toString() => 'DebugAdapterException: $message'; @@ -37,12 +40,16 @@ class DebugAdapterInvalidArgumentException implements DebugAdapterException { final Type actualType; final Object? actualValue; + @override + final bool showToUser; + DebugAdapterInvalidArgumentException({ required this.requestName, required this.argumentName, required this.expectedType, required this.actualType, required this.actualValue, + this.showToUser = false, }); @override diff --git a/third_party/pkg/dap/pubspec.yaml b/third_party/pkg/dap/pubspec.yaml index 5e200c5a638e..53c3fbea9443 100644 --- a/third_party/pkg/dap/pubspec.yaml +++ b/third_party/pkg/dap/pubspec.yaml @@ -1,5 +1,5 @@ name: dap -version: 1.2.0 +version: 1.3.0 description: >- A package of classes that are generated from the DAP specifications along with their generating code. diff --git a/tools/VERSION b/tools/VERSION index 8be83bb84b3a..6b0bbec06df6 100644 --- a/tools/VERSION +++ b/tools/VERSION @@ -27,5 +27,5 @@ CHANNEL dev MAJOR 3 MINOR 5 PATCH 0 -PRERELEASE 223 +PRERELEASE 224 PRERELEASE_PATCH 0