Version 2.16.0-104.0.dev
Merge commit '5bef7fe3fb5d0b528681d60fa05a134f4f3d7353' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 185379d..2436af7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -64,7 +64,7 @@
- adds new lint: `use_decorated_box`.
- improves docs for `omit_local_variable_types`.
-## 2.15.0
+## 2.15.0 - 2021-12-08
### Language
diff --git a/pkg/analysis_server/lib/plugin/edit/fix/fix_dart.dart b/pkg/analysis_server/lib/plugin/edit/fix/fix_dart.dart
index 444a61b..4ffbedf 100644
--- a/pkg/analysis_server/lib/plugin/edit/fix/fix_dart.dart
+++ b/pkg/analysis_server/lib/plugin/edit/fix/fix_dart.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analysis_server/plugin/edit/fix/fix_core.dart';
-import 'package:analysis_server/src/services/completion/dart/extension_cache.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/instrumentation/service.dart';
@@ -13,9 +12,6 @@
///
/// Clients may not extend, implement or mix-in this class.
abstract class DartFixContext implements FixContext {
- /// Return the extension cache used to find available extensions.
- ExtensionCache get extensionCache;
-
/// Return the instrumentation service used to report errors that prevent a
/// fix from being composed.
InstrumentationService get instrumentationService;
@@ -31,4 +27,8 @@
Future<Map<LibraryElement, List<Element>>> getTopLevelDeclarations(
String name,
);
+
+ /// Return libraries with extensions that declare non-static public
+ /// extension members with the [memberName].
+ Stream<LibraryElement> librariesWithExtensions(String memberName);
}
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index dc3332a..4c8b529 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -783,7 +783,6 @@
var path = result.path;
analysisServer.getDocumentationCacheFor(result)?.cacheFromResult(result);
- analysisServer.getExtensionCacheFor(result)?.cacheFromResult(result);
var unit = result.unit;
if (analysisServer._hasAnalysisServiceSubscription(
diff --git a/pkg/analysis_server/lib/src/analysis_server_abstract.dart b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
index cf39073..b94ee3f 100644
--- a/pkg/analysis_server/lib/src/analysis_server_abstract.dart
+++ b/pkg/analysis_server/lib/src/analysis_server_abstract.dart
@@ -15,7 +15,6 @@
import 'package:analysis_server/src/server/crash_reporting_attachments.dart';
import 'package:analysis_server/src/server/diagnostic_server.dart';
import 'package:analysis_server/src/services/completion/dart/documentation_cache.dart';
-import 'package:analysis_server/src/services/completion/dart/extension_cache.dart';
import 'package:analysis_server/src/services/correction/namespace.dart';
import 'package:analysis_server/src/services/pub/pub_api.dart';
import 'package:analysis_server/src/services/pub/pub_command.dart';
@@ -95,10 +94,6 @@
/// each context.
Map<AnalysisContext, DocumentationCache> documentationForContext = {};
- /// A map from analysis contexts to the extension cache associated with
- /// each context.
- Map<AnalysisContext, ExtensionCache> extensionForContext = {};
-
/// The DiagnosticServer for this AnalysisServer. If available, it can be used
/// to start an http diagnostics server or return the port for an existing
/// server.
@@ -252,7 +247,6 @@
void addContextsToDeclarationsTracker() {
declarationsTracker?.discardContexts();
documentationForContext.clear();
- extensionForContext.clear();
for (var driver in driverMap.values) {
declarationsTracker?.addContext(driver.analysisContext!);
}
@@ -383,14 +377,6 @@
return element;
}
- /// Return the object used to cache information about extensions in the
- /// context that produced the [result], or `null` if there is no cache for the
- /// context.
- ExtensionCache? getExtensionCacheFor(ResolvedUnitResult result) {
- var context = result.session.analysisContext;
- return extensionForContext.putIfAbsent(context, () => ExtensionCache());
- }
-
/// Return a [Future] that completes with the resolved [AstNode] at the
/// given [offset] of the given [file], or with `null` if there is no node as
/// the [offset].
diff --git a/pkg/analysis_server/lib/src/cider/fixes.dart b/pkg/analysis_server/lib/src/cider/fixes.dart
index 279cbd1..560a849 100644
--- a/pkg/analysis_server/lib/src/cider/fixes.dart
+++ b/pkg/analysis_server/lib/src/cider/fixes.dart
@@ -97,4 +97,7 @@
}
return result;
}
+
+ @override
+ Stream<LibraryElement> librariesWithExtensions(String memberName) async* {}
}
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 7605699..655d9d9 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -603,8 +603,7 @@
if (errorLine == requestLine) {
var workspace = DartChangeWorkspace(server.currentSessions);
var context = DartFixContextImpl(
- server.instrumentationService, workspace, result, error,
- extensionCache: server.getExtensionCacheFor(result));
+ server.instrumentationService, workspace, result, error);
List<Fix> fixes;
try {
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart
index 82ba7c1..521927d 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart
@@ -346,8 +346,7 @@
}
var workspace = DartChangeWorkspace(server.currentSessions);
var context = DartFixContextImpl(
- server.instrumentationService, workspace, unit, error,
- extensionCache: server.getExtensionCacheFor(unit));
+ server.instrumentationService, workspace, unit, error);
final fixes = await fixContributor.computeFixes(context);
if (fixes.isNotEmpty) {
final diagnostic = toDiagnostic(
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index cf22460..55a9da8 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -896,7 +896,6 @@
var path = result.path;
analysisServer.getDocumentationCacheFor(result)?.cacheFromResult(result);
- analysisServer.getExtensionCacheFor(result)?.cacheFromResult(result);
final unit = result.unit;
if (analysisServer.shouldSendClosingLabelsFor(path)) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/extension_cache.dart b/pkg/analysis_server/lib/src/services/completion/dart/extension_cache.dart
deleted file mode 100644
index 38481dc..0000000
--- a/pkg/analysis_server/lib/src/services/completion/dart/extension_cache.dart
+++ /dev/null
@@ -1,105 +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 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/element/element.dart';
-
-/// Cached data about the extensions defined in a single analysis context.
-class ExtensionCache {
- /// A set containing the paths of the compilation units that have been cached.
- /// The set is used to prevent caching the same data multiple times.
- final Set<String> processedUnits = {};
-
- /// A map from the name of a non-static public extension member to the set of
- /// paths to libraries defining an extension member with that name.
- final Map<String, Set<UnitInLibrary>> membersByName = {};
-
- /// Initialize a newly created cache.
- ExtensionCache();
-
- /// Fill the cache with data from the [result].
- void cacheFromResult(ResolvedUnitResult result) {
- var element = result.unit.declaredElement;
- if (element != null) {
- _cacheFromElement(element);
- for (var library in result.libraryElement.importedLibraries) {
- _cacheLibrary(library);
- }
- }
- }
-
- /// Fill the cache with data from the [compilationUnit].
- void _cacheFromElement(CompilationUnitElement compilationUnit) {
- // Record that we've cached data for the compilation unit.
- var unitPath = _keyForUnit(compilationUnit);
- processedUnits.add(unitPath);
-
- // Flush any data that was previously cached for the compilation unit.
- for (var set in membersByName.values) {
- set.removeWhere((element) => element.unitPath == unitPath);
- }
-
- // Cache the data for the compilation unit.
- var libraryPath = compilationUnit.librarySource.fullName;
- for (var extension in compilationUnit.extensions) {
- var extensionName = extension.name;
- if (extensionName != null && !Identifier.isPrivateName(extensionName)) {
- for (var member in extension.accessors) {
- if (!member.isSynthetic) {
- _recordMember(unitPath, libraryPath, member.displayName);
- }
- }
- for (var member in extension.fields) {
- if (!member.isSynthetic) {
- _recordMember(unitPath, libraryPath, member.name);
- }
- }
- for (var member in extension.methods) {
- _recordMember(unitPath, libraryPath, member.name);
- }
- }
- }
- }
-
- /// Cache the data for the given [library] and every library exported from it
- /// if it hasn't already been cached.
- void _cacheLibrary(LibraryElement library) {
- if (_hasDataFor(library.definingCompilationUnit)) {
- return;
- }
- for (var unit in library.units) {
- _cacheFromElement(unit);
- }
- for (var exported in library.exportedLibraries) {
- _cacheLibrary(exported);
- }
- }
-
- /// Return `true` if the cache contains data for the [compilationUnit].
- bool _hasDataFor(CompilationUnitElement compilationUnit) {
- return processedUnits.contains(_keyForUnit(compilationUnit));
- }
-
- /// Return the key used in the [extensionCache] for the [compilationUnit].
- String _keyForUnit(CompilationUnitElement compilationUnit) =>
- compilationUnit.source.fullName;
-
- /// Record that an extension member with the given [name] is defined in the
- /// compilation unit with the [unitPath] in the library with the
- /// [libraryPath].
- void _recordMember(String unitPath, String libraryPath, String name) {
- membersByName
- .putIfAbsent(name, () => {})
- .add(UnitInLibrary(unitPath, libraryPath));
- }
-}
-
-/// A representation of a compilation unit in a library.
-class UnitInLibrary {
- final String unitPath;
- final String libraryPath;
-
- UnitInLibrary(this.unitPath, this.libraryPath);
-}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart b/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
index 16f03aa..cdfb928 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
@@ -6,7 +6,6 @@
import 'package:_fe_analyzer_shared/src/scanner/token.dart';
import 'package:analysis_server/plugin/edit/fix/fix_dart.dart';
-import 'package:analysis_server/src/services/completion/dart/extension_cache.dart';
import 'package:analysis_server/src/services/correction/fix/data_driven/transform_override_set.dart';
import 'package:analysis_server/src/services/correction/util.dart';
import 'package:analysis_server/src/utilities/flutter.dart';
@@ -412,9 +411,6 @@
/// Returns the EOL to use for this [CompilationUnit].
String get eol => utils.endOfLine;
- /// Return the extension cache used to find available extensions.
- ExtensionCache get extensionCache => _context.dartFixContext!.extensionCache;
-
String get file => _context.file;
Flutter get flutter => Flutter.instance;
@@ -525,6 +521,12 @@
return false;
}
+ /// Return libraries with extensions that declare non-static public
+ /// extension members with the [memberName].
+ Stream<LibraryElement> librariesWithExtensions(String memberName) {
+ return _context.dartFixContext!.librariesWithExtensions(memberName);
+ }
+
/// Return `true` if the given [node] is in a location where an implicit
/// constructor invocation would be allowed.
bool mightBeImplicitConstructor(AstNode node) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart b/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart
index 0dd6cca..27f0488 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart
@@ -9,7 +9,6 @@
import 'package:analysis_server/src/services/correction/namespace.dart';
import 'package:analysis_server/src/services/linter/lint_names.dart';
import 'package:analysis_server/src/utilities/extensions/element.dart';
-import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
@@ -45,16 +44,9 @@
if (targetType == null) {
return;
}
- var definingLibraries =
- extensionCache.membersByName[memberName]?.toList();
- if (definingLibraries != null) {
- for (var definingLibrary in definingLibraries) {
- var libraryPath = definingLibrary.libraryPath;
- var uri = sessionHelper.session.uriConverter.pathToUri(libraryPath);
- if (uri != null) {
- yield* _importExtensionInLibrary(uri, targetType, memberName);
- }
- }
+ await for (var libraryToImport in librariesWithExtensions(memberName)) {
+ yield* _importExtensionInLibrary(
+ libraryToImport, targetType, memberName);
}
}
@@ -146,7 +138,10 @@
}
Stream<CorrectionProducer> _importExtensionInLibrary(
- Uri uri, DartType targetType, String memberName) async* {
+ LibraryElement libraryToImport,
+ DartType targetType,
+ String memberName,
+ ) async* {
// Look to see whether the library at the [uri] is already imported. If it
// is, then we can check the extension elements without needing to perform
// additional analysis.
@@ -154,7 +149,7 @@
for (var imp in libraryElement.imports) {
// prepare element
var importedLibrary = imp.importedLibrary;
- if (importedLibrary == null || importedLibrary.source.uri != uri) {
+ if (importedLibrary == null || importedLibrary != libraryToImport) {
continue;
}
foundImport = true;
@@ -169,8 +164,8 @@
// TODO(brianwilkerson) Support removing the extension name from a
// hide combinator.
} else if (combinator is ShowElementCombinator) {
- yield _ImportLibraryShow(
- uri.toString(), combinator, extension.name!);
+ yield _ImportLibraryShow(libraryToImport.source.uri.toString(),
+ combinator, extension.name!);
}
}
}
@@ -180,7 +175,8 @@
// correction producer that will either add an import or not based on the
// result of analyzing the library.
if (!foundImport) {
- yield _ImportLibraryContainingExtension(uri, targetType, memberName);
+ yield _ImportLibraryContainingExtension(
+ libraryToImport, targetType, memberName);
}
}
@@ -429,8 +425,8 @@
/// A correction processor that can add an import of a library containing an
/// extension, but which does so only if the extension applies to a given type.
class _ImportLibraryContainingExtension extends CorrectionProducer {
- /// The URI of the library defining the extension.
- Uri uri;
+ /// The library defining the extension.
+ LibraryElement library;
/// The type of the target that the extension must apply to.
DartType targetType;
@@ -441,7 +437,11 @@
/// The URI that is being proposed for the import directive.
String _uriText = '';
- _ImportLibraryContainingExtension(this.uri, this.targetType, this.memberName);
+ _ImportLibraryContainingExtension(
+ this.library,
+ this.targetType,
+ this.memberName,
+ );
@override
List<Object> get fixArguments => [_uriText];
@@ -451,16 +451,12 @@
@override
Future<void> compute(ChangeBuilder builder) async {
- var result = await sessionHelper.session.getLibraryByUri(uri.toString());
- if (result is LibraryElementResult) {
- var library = result.element;
- if (library
- .matchingExtensionsWithMember(libraryElement, targetType, memberName)
- .isNotEmpty) {
- await builder.addDartFileEdit(file, (builder) {
- _uriText = builder.importLibrary(uri);
- });
- }
+ if (library
+ .matchingExtensionsWithMember(libraryElement, targetType, memberName)
+ .isNotEmpty) {
+ await builder.addDartFileEdit(file, (builder) {
+ _uriText = builder.importLibrary(library.source.uri);
+ });
}
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index 962ffde..5c02856 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analysis_server/plugin/edit/fix/fix_dart.dart';
-import 'package:analysis_server/src/services/completion/dart/extension_cache.dart';
+import 'package:analysis_server/src/services/correction/fix/dart/extensions.dart';
import 'package:analysis_server/src/services/correction/fix/dart/top_level_declarations.dart';
import 'package:analysis_server/src/services/correction/fix_internal.dart';
import 'package:analyzer/dart/analysis/results.dart';
@@ -56,19 +56,19 @@
@override
final AnalysisError error;
- @override
- final ExtensionCache extensionCache;
-
DartFixContextImpl(this.instrumentationService, this.workspace,
- this.resolveResult, this.error,
- {ExtensionCache? extensionCache})
- : extensionCache = extensionCache ?? ExtensionCache();
+ this.resolveResult, this.error);
@override
Future<Map<LibraryElement, List<Element>>> getTopLevelDeclarations(
String name) async {
return TopLevelDeclarations(resolveResult).withName(name);
}
+
+ @override
+ Stream<LibraryElement> librariesWithExtensions(String memberName) {
+ return Extensions(resolveResult).libraries(memberName);
+ }
}
/// An enumeration of quick fix kinds found in a Dart file.
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/dart/extensions.dart b/pkg/analysis_server/lib/src/services/correction/fix/dart/extensions.dart
new file mode 100644
index 0000000..b613ec7
--- /dev/null
+++ b/pkg/analysis_server/lib/src/services/correction/fix/dart/extensions.dart
@@ -0,0 +1,47 @@
+// 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 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
+import 'package:analyzer/src/dart/analysis/file_state_filter.dart';
+
+class Extensions {
+ final ResolvedUnitResult resolvedUnit;
+
+ Extensions(this.resolvedUnit);
+
+ DriverBasedAnalysisContext get _analysisContext {
+ var analysisContext = resolvedUnit.session.analysisContext;
+ return analysisContext as DriverBasedAnalysisContext;
+ }
+
+ /// Return libraries that may be imported into the [resolvedUnit] file,
+ /// and might have extensions that define a non-static public member with
+ /// the [memberName].
+ Stream<LibraryElement> libraries(String memberName) async* {
+ var analysisDriver = _analysisContext.driver;
+ await analysisDriver.discoverAvailableFiles();
+
+ var fsState = analysisDriver.fsState;
+ var filter = FileStateFilter(
+ fsState.getFileForPath(resolvedUnit.path),
+ );
+
+ for (var file in fsState.knownFiles.toList()) {
+ if (!filter.shouldInclude(file)) {
+ continue;
+ }
+
+ var libraryElement = analysisDriver.getLibraryByFile(file);
+ if (libraryElement == null) {
+ continue;
+ }
+
+ yield libraryElement;
+ }
+ }
+}
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 b3a9980..6b3f145 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -251,7 +251,6 @@
workspace,
resolveResult,
error,
- extensionCache: context.extensionCache,
);
fixState = await _fixError(fixContext, fixState, generator(), error);
}
diff --git a/pkg/analysis_server/lib/src/utilities/extensions/element.dart b/pkg/analysis_server/lib/src/utilities/extensions/element.dart
index 764d8ab..3c2b11d 100644
--- a/pkg/analysis_server/lib/src/utilities/extensions/element.dart
+++ b/pkg/analysis_server/lib/src/utilities/extensions/element.dart
@@ -96,15 +96,20 @@
LibraryElement containingLibrary,
DartType targetType,
String memberName) sync* {
- for (var unit in units) {
- for (var extension in unit.extensions) {
+ for (var extension in exportNamespace.definedNames.values) {
+ if (extension is ExtensionElement) {
var extensionName = extension.name;
if (extensionName != null && !Identifier.isPrivateName(extensionName)) {
var extendedType =
extension.resolvedExtendedType(containingLibrary, targetType);
if (extendedType != null &&
typeSystem.isSubtypeOf(targetType, extendedType)) {
- yield extension;
+ // TODO(scheglov) share with analyzer
+ if (extension.getMethod(memberName) != null ||
+ extension.getGetter(memberName) != null ||
+ extension.getSetter(memberName) != null) {
+ yield extension;
+ }
}
}
}
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 8c39cb0..fc0eaa0 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
@@ -3,12 +3,10 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analysis_server/plugin/edit/fix/fix_core.dart';
-import 'package:analysis_server/src/services/completion/dart/extension_cache.dart';
import 'package:analysis_server/src/services/correction/bulk_fix_processor.dart';
import 'package:analysis_server/src/services/correction/change_workspace.dart';
import 'package:analysis_server/src/services/correction/fix.dart';
import 'package:analysis_server/src/services/correction/fix_internal.dart';
-import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/error/lint_codes.dart';
@@ -245,17 +243,9 @@
/// A base class defining support for writing fix processor tests.
abstract class FixProcessorTest extends BaseFixProcessorTest {
- /// The extension cache used for test purposes.
- ExtensionCache extensionCache = ExtensionCache();
-
/// Return the kind of fixes being tested by this test class.
FixKind get kind;
- Future<void> addUnimportedFile(String filePath, String content) async {
- addSource(filePath, content);
- await cacheExtensionsForFile(filePath);
- }
-
Future<void> assertHasFix(String expected,
{bool Function(AnalysisError)? errorFilter,
int? length,
@@ -366,11 +356,6 @@
await _assertNoFixAllFix(error);
}
- Future<void> cacheExtensionsForFile(String path) async {
- var result = await session.getResolvedUnit(convertPath(path));
- extensionCache.cacheFromResult(result as ResolvedUnitResult);
- }
-
List<LinkedEditSuggestion> expectedSuggestions(
LinkedEditSuggestionKind kind, List<String> values) {
return values.map((value) {
@@ -511,14 +496,11 @@
/// Computes fixes for the given [error] in [testUnit].
Future<List<Fix>> _computeFixes(AnalysisError error) async {
- extensionCache.cacheFromResult(testAnalysisResult);
-
var context = DartFixContextImpl(
TestInstrumentationService(),
workspace,
testAnalysisResult,
error,
- extensionCache: extensionCache,
);
return await DartFixContributor().computeFixes(context);
}
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 99f9bf1..9151d48 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
@@ -40,7 +40,7 @@
}
Future<void> test_extension_notImported_field_onThisType_fromClass() async {
- addUnimportedFile('$testPackageLibPath/lib2.dart', '''
+ addSource('$testPackageLibPath/lib2.dart', '''
import 'package:test/lib1.dart';
extension E on C {
@@ -68,7 +68,7 @@
}
Future<void> test_extension_notImported_getter() async {
- addUnimportedFile('$testPackageLibPath/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
extension E on String {
int get m => 0;
}
@@ -88,7 +88,7 @@
}
Future<void> test_extension_notImported_method() async {
- addUnimportedFile('$testPackageLibPath/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
extension E on String {
void m() {}
}
@@ -108,7 +108,7 @@
}
Future<void> test_extension_notImported_method_extendsGeneric() async {
- addUnimportedFile('$testPackageLibPath/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
import 'package:test/lib1.dart';
extension E<T extends num> on List<T> {
@@ -130,7 +130,7 @@
}
Future<void> test_extension_notImported_method_onThisType_fromClass() async {
- addUnimportedFile('$testPackageLibPath/lib2.dart', '''
+ addSource('$testPackageLibPath/lib2.dart', '''
import 'package:test/lib1.dart';
extension E on C {
@@ -163,7 +163,7 @@
Future<void>
test_extension_notImported_method_onThisType_fromExtension() async {
- addUnimportedFile('$testPackageLibPath/lib2.dart', '''
+ addSource('$testPackageLibPath/lib2.dart', '''
import 'package:test/lib1.dart';
extension E on C {
@@ -195,7 +195,7 @@
}
Future<void> test_extension_notImported_operator() async {
- addUnimportedFile('$testPackageLibPath/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
extension E on String {
String operator -(String other) => this;
}
@@ -215,7 +215,7 @@
}
Future<void> test_extension_notImported_setter() async {
- addUnimportedFile('$testPackageLibPath/lib.dart', '''
+ addSource('$testPackageLibPath/lib.dart', '''
extension E on String {
set m(int v) {}
}
@@ -234,15 +234,14 @@
''');
}
- @FailingTest(reason: 'We suggest importing src/b.dart')
Future<void> test_extension_otherPackage_exported_fromSrc() async {
var pkgRootPath = '/.pub-cache/aaa';
- var a = newFile('$pkgRootPath/lib/a.dart', content: r'''
+ newFile('$pkgRootPath/lib/a.dart', content: r'''
export 'src/b.dart';
''');
- var b = newFile('$pkgRootPath/lib/src/b.dart', content: r'''
+ newFile('$pkgRootPath/lib/src/b.dart', content: r'''
extension IntExtension on int {
int get foo => 0;
}
@@ -258,9 +257,6 @@
aaa: any
''');
- await cacheExtensionsForFile(a.path);
- await cacheExtensionsForFile(b.path);
-
await resolveTestCode('''
void f() {
0.foo;
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 26b0647..277a778 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -54,7 +54,6 @@
LibTest/core/int/parse_A01_t02: SkipByDesign # uses integer literal not representable as JavaScript number
LibTest/core/int/remainder_A01_t03: SkipByDesign # Division by zero is not an error in JavaScript
LibTest/ffi/*: SkipByDesign # dart:ffi is not supported
-LibTest/html/HttpRequestUpload/*: Skip # https://github.com/dart-lang/co19/issues/932
LibTest/io/*: SkipByDesign # dart:io not supported.
LibTest/isolate/*: SkipByDesign # dart:isolate not supported.
LibTest/mirrors/*: SkipByDesign # dart:mirrors is not supported
diff --git a/tests/co19/co19-dartdevc.status b/tests/co19/co19-dartdevc.status
index 4fa6538..3458c5c 100644
--- a/tests/co19/co19-dartdevc.status
+++ b/tests/co19/co19-dartdevc.status
@@ -50,7 +50,6 @@
LibTest/core/int/parse_A01_t02: SkipByDesign # big integers cannot be represented in JavaScript
LibTest/core/int/remainder_A01_t03: SkipByDesign # Division by zero is not an error in JavaScript
LibTest/ffi/*: SkipByDesign # dart:ffi is not supported
-LibTest/html/HttpRequestUpload/*: Skip # https://github.com/dart-lang/co19/issues/932
LibTest/io/*: SkipByDesign # dart:io not supported.
LibTest/isolate/*: SkipByDesign # dart:isolate not supported.
LibTest/mirrors/*: SkipByDesign # dart:mirrors is not supported
diff --git a/tools/VERSION b/tools/VERSION
index 12fd2cd..2b9050c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 16
PATCH 0
-PRERELEASE 103
+PRERELEASE 104
PRERELEASE_PATCH 0
\ No newline at end of file