Version 2.13.0-22.0.dev

Merge commit 'e30e0cd410641dfcd52564c08d45ac1b801eb7b5' into 'dev'
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index ee58748..4afcb19 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -402,8 +402,8 @@
     set_default_toolchain("//build/toolchain/linux:$current_cpu")
   }
 } else if (is_mac) {
-  host_toolchain = "//build/toolchain/mac:clang_x64"
-  set_default_toolchain(host_toolchain)
+  host_toolchain = "//build/toolchain/mac:clang_$host_cpu"
+  set_default_toolchain("//build/toolchain/mac:clang_$current_cpu")
 } else if (is_fuchsia) {
   assert(host_os == "linux")
   assert(host_cpu == "x64")
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 3e06c16..e6e7c2d 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -92,7 +92,7 @@
     }
 
     # Enable mitigations for Cortex-A53 Erratum #843419 bug.
-    if (current_cpu == "arm64" && is_clang) {
+    if (current_cpu == "arm64" && is_clang && !is_mac) {
       ldflags += [ "-Wl,--fix-cortex-a53-843419" ]
     }
 
diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn
index c6f28d3..2b9c426 100644
--- a/build/toolchain/mac/BUILD.gn
+++ b/build/toolchain/mac/BUILD.gn
@@ -244,3 +244,19 @@
   }
   sysroot_flags = "-isysroot $mac_sdk_path -mmacosx-version-min=$mac_sdk_min"
 }
+
+mac_toolchain("clang_arm64") {
+  toolchain_cpu = "arm64"
+  toolchain_os = "mac"
+  prefix = rebase_path("//buildtools/mac-x64/clang/bin", root_build_dir)
+  cc = "${goma_prefix}$prefix/clang"
+  cxx = "${goma_prefix}$prefix/clang++"
+  ar = "${prefix}/llvm-ar"
+  ld = cxx
+  strip = "strip"
+  is_clang = true
+  if (mac_enable_relative_sdk_path) {
+    mac_sdk_path = rebase_path(mac_sdk_path, root_build_dir)
+  }
+  sysroot_flags = "-isysroot $mac_sdk_path -mmacosx-version-min=$mac_sdk_min"
+}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart
index ecaa1a8..55f7613 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart
@@ -27,10 +27,12 @@
   @override
   Future<void> computeSuggestions(
       DartCompletionRequest request, SuggestionBuilder builder) async {
-    var executable = request.target.executableElement;
-    if (executable == null) {
+    var parameters = request.target.executableElement?.parameters ??
+        request.target.functionType?.parameters;
+    if (parameters == null) {
       return;
     }
+
     var node = request.target.containingNode;
     if (node is ArgumentList) {
       argumentList = node;
@@ -38,7 +40,7 @@
 
     this.request = request;
     this.builder = builder;
-    _addSuggestions(executable.parameters);
+    _addSuggestions(parameters);
   }
 
   void _addDefaultParamSuggestions(Iterable<ParameterElement> parameters,
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 55d892e..3cacd94 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -163,6 +163,7 @@
 import 'package:analyzer_plugin/protocol/protocol_common.dart'
     hide AnalysisError, Element, ElementKind;
 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
+import 'package:analyzer_plugin/utilities/change_builder/change_workspace.dart';
 import 'package:analyzer_plugin/utilities/change_builder/conflicting_edit_exception.dart';
 import 'package:analyzer_plugin/utilities/fixes/fixes.dart' hide FixContributor;
 
@@ -278,10 +279,8 @@
 
   Future<List<Fix>> compute() async {
     var error = context.error;
-    var errors = context.resolveResult.errors.toList();
-    // Remove any analysis errors that don't have the expected error code name
-    errors.removeWhere((e) => error.errorCode.name != e.errorCode.name);
-
+    var errors = context.resolveResult.errors
+        .where((e) => error.errorCode.name == e.errorCode.name);
     if (errors.length < 2) {
       return const <Fix>[];
     }
@@ -303,7 +302,7 @@
 
     var fixes = <Fix>[];
     for (var generator in generators) {
-      var builder = ChangeBuilder(workspace: workspace);
+      var fixInfo = FixInfo(workspace);
       for (var error in errors) {
         var fixContext = DartFixContextImpl(
           instrumentationService,
@@ -312,13 +311,12 @@
           error,
           (name) => [],
         );
-        builder = await _fixError(fixContext, builder, generator(), error);
+        await _fixError(fixContext, fixInfo, generator(), error);
       }
-      var sourceChange = builder.sourceChange;
+      var sourceChange = fixInfo.builder.sourceChange;
       if (sourceChange.edits.isNotEmpty) {
-        var fixKind = generator().fixKind;
-        // todo (pq): with a table redesign we can bail earlier.
-        if (fixKind.canBeAppliedTogether()) {
+        var fixKind = fixInfo.fixKind;
+        if (fixKind.canBeAppliedTogether() && fixInfo.fixCount > 1) {
           sourceChange.message = fixKind.appliedTogetherMessage;
           fixes.add(Fix(fixKind, sourceChange));
         }
@@ -327,11 +325,8 @@
     return fixes;
   }
 
-  Future<ChangeBuilder> _fixError(
-      DartFixContext fixContext,
-      ChangeBuilder builder,
-      CorrectionProducer producer,
-      AnalysisError diagnostic) async {
+  Future<void> _fixError(DartFixContext fixContext, FixInfo fixInfo,
+      CorrectionProducer producer, AnalysisError diagnostic) async {
     var context = CorrectionProducerContext(
       applyingBulkFixes: true,
       dartFixContext: fixContext,
@@ -344,21 +339,23 @@
 
     var setupSuccess = context.setupCompute();
     if (!setupSuccess) {
-      return null;
+      return;
     }
 
     producer.configure(context);
 
     try {
-      var localBuilder = builder.copy();
+      var localBuilder = fixInfo.builder.copy();
       await producer.compute(localBuilder);
-      builder = localBuilder;
+      fixInfo.builder = localBuilder;
+      // todo (pq): consider discarding the change if the producer's fixKind
+      // doesn't match a previously cached one.
+      fixInfo.fixKind = producer.fixKind;
+      fixInfo.fixCount++;
     } on ConflictingEditException {
       // If a conflicting edit was added in [compute], then the [localBuilder]
       // is discarded and we revert to the previous state of the builder.
     }
-
-    return builder;
   }
 
   List<ProducerGenerator> _getGenerators(
@@ -382,6 +379,15 @@
   }
 }
 
+/// Info used while producing fix all in file fixes.
+class FixInfo {
+  ChangeBuilder builder;
+  FixKind fixKind;
+  int fixCount = 0;
+  FixInfo(ChangeWorkspace workspace)
+      : builder = ChangeBuilder(workspace: workspace);
+}
+
 /// The computer for Dart fixes.
 class FixProcessor extends BaseProcessor {
   /// A map from the names of lint rules to a list of generators used to create
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 0f6e004..1004b9b 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
@@ -1067,6 +1067,18 @@
     assertNoSuggestions();
   }
 
+  Future<void> test_ArgumentList_local_functionExpression_params() async {
+    // https://github.com/dart-lang/sdk/issues/42064
+    addTestSource('''
+    void main2() {
+      final add1 = ({int a}) => a + 1;
+      add1(^);
+    }
+    ''');
+    await computeSuggestions();
+    assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'a': 'int'});
+  }
+
   Future<void> test_ArgumentList_local_method_0() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
     addSource('/home/test/lib/a.dart', '''
diff --git a/pkg/analysis_server/test/src/cider/cider_service.dart b/pkg/analysis_server/test/src/cider/cider_service.dart
index ccc8b91..a1a0f10 100644
--- a/pkg/analysis_server/test/src/cider/cider_service.dart
+++ b/pkg/analysis_server/test/src/cider/cider_service.dart
@@ -14,8 +14,6 @@
 import 'package:linter/src/rules.dart';
 
 class CiderServiceTest with ResourceProviderMixin {
-  static final String _testPath = '/workspace/dart/test/lib/test.dart';
-
   final ByteStore byteStore = MemoryByteStore();
 
   final StringBuffer logBuffer = StringBuffer();
@@ -24,7 +22,7 @@
 
   FileResolver fileResolver;
 
-  String get testPath => _testPath;
+  String testPath = '/workspace/dart/test/lib/test.dart';
 
   /// Create a new [FileResolver] into [fileResolver].
   ///
@@ -32,7 +30,7 @@
   void createFileResolver() {
     var workspace = BazelWorkspace.find(
       resourceProvider,
-      convertPath(_testPath),
+      convertPath(testPath),
     );
 
     fileResolver = FileResolver(
diff --git a/pkg/analysis_server/test/src/cider/completion_test.dart b/pkg/analysis_server/test/src/cider/completion_test.dart
index e272ab9..cc3ed2d 100644
--- a/pkg/analysis_server/test/src/cider/completion_test.dart
+++ b/pkg/analysis_server/test/src/cider/completion_test.dart
@@ -558,6 +558,17 @@
     _assertHasMethod(text: 'foo');
   }
 
+  Future<void> test_limitedResolution_path_hasSpace() async {
+    testPath = convertPath('/workspace/dart/test name/lib/a.dart');
+    await _compute(r'''
+class A {}
+^
+''');
+
+    _assertHasClass(text: 'int');
+    _assertHasClass(text: 'A');
+  }
+
   Future<void> test_limitedResolution_unit_function_body() async {
     _configureToCheckNotResolved(
       identifiers: {'print'},
diff --git a/pkg/analysis_server/test/src/services/correction/fix/fix_in_file_test.dart b/pkg/analysis_server/test/src/services/correction/fix/fix_in_file_test.dart
index a73400b..b25ccc5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/fix_in_file_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/fix_in_file_test.dart
@@ -54,7 +54,7 @@
 
 @reflectiveTest
 class SingleFixInFileTest extends FixInFileProcessorTest {
-  Future<void> test_isNull() async {
+  Future<void> test_fix_isNull() async {
     await resolveTestCode('''
 bool f(p, q) {
   return p is Null && q is Null;
@@ -69,6 +69,17 @@
 }
 ''');
   }
+
+  Future<void> test_noFixes() async {
+    await resolveTestCode('''
+bool f(p, q) {
+  return p is Null;
+}
+''');
+
+    var fixes = await getFixes();
+    expect(fixes, isEmpty);
+  }
 }
 
 /// todo (pq): add negative tests
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 ac90224..1fd5da2 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
@@ -99,6 +99,10 @@
     var fileEdits = fix.change.edits;
     expect(fileEdits, hasLength(1));
 
+    if (useLineEndingsForPlatform) {
+      expected = normalizeNewlinesForPlatform(expected);
+    }
+
     var fileContent = testCode;
     resultCode = SourceEdit.applySequence(fileContent, fileEdits[0].edits);
     expect(resultCode, expected);
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index f98aff1..71d0aa1 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -9,6 +9,7 @@
 * Removed `NullSafetyUnderstandingFlag`.
 * Removed `functionTypeAliasElement` from `TypeSystem.instantiateToBounds2`.
 * Added `Annotation.typeArguments` in preparation for supporting #44838.
+* Removed `actualUri` from `UriResolver.resolveAbsolute`.
 
 ## 0.41.1
 * Updated `PackageBuildWorkspace` that supports `package:build` to stop
diff --git a/pkg/analyzer/lib/src/context/source.dart b/pkg/analyzer/lib/src/context/source.dart
index 714c9c6..74548b6 100644
--- a/pkg/analyzer/lib/src/context/source.dart
+++ b/pkg/analyzer/lib/src/context/source.dart
@@ -186,14 +186,12 @@
           utils.resolveRelativeUri(containingSource.uri, containedUri);
     }
 
-    Uri actualUri = containedUri;
-
-    var result = _absoluteUriToSourceCache[actualUri];
+    var result = _absoluteUriToSourceCache[containedUri];
     if (result == null) {
       for (UriResolver resolver in resolvers) {
-        result = resolver.resolveAbsolute(containedUri, actualUri);
+        result = resolver.resolveAbsolute(containedUri);
         if (result != null) {
-          _absoluteUriToSourceCache[actualUri] = result;
+          _absoluteUriToSourceCache[containedUri] = result;
           break;
         }
       }
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 838334a..2233c50 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -3055,17 +3055,6 @@
     }
     return annotations;
   }
-
-  /// If the given [type] is a generic function type, then the element
-  /// associated with the type is implicitly a child of this element and should
-  /// be visited by the given [visitor].
-  void _safelyVisitPossibleChild(DartType? type, ElementVisitor visitor) {
-    var element = type?.element;
-    if (element is GenericFunctionTypeElementImpl &&
-        element.enclosingElement is! FunctionTypeAliasElement) {
-      element.accept(visitor);
-    }
-  }
 }
 
 /// Abstract base class for elements whose type is guaranteed to be a function
@@ -3681,7 +3670,6 @@
   @override
   void visitChildren(ElementVisitor visitor) {
     super.visitChildren(visitor);
-    _safelyVisitPossibleChild(returnType, visitor);
     safelyVisitChildren(typeParameters, visitor);
     safelyVisitChildren(parameters, visitor);
   }
@@ -4532,7 +4520,6 @@
   @override
   void visitChildren(ElementVisitor visitor) {
     super.visitChildren(visitor);
-    _safelyVisitPossibleChild(returnType, visitor);
     safelyVisitChildren(typeParameters, visitor);
     safelyVisitChildren(parameters, visitor);
   }
diff --git a/pkg/analyzer/lib/src/dart/micro/library_graph.dart b/pkg/analyzer/lib/src/dart/micro/library_graph.dart
index f5e42bb..eba5e3b 100644
--- a/pkg/analyzer/lib/src/dart/micro/library_graph.dart
+++ b/pkg/analyzer/lib/src/dart/micro/library_graph.dart
@@ -556,9 +556,16 @@
       var fileUri = _resourceProvider.pathContext.toUri(path);
       var uri = _sourceFactory.restoreUri(
         _FakeSource(path, fileUri),
-      )!;
+      );
+      if (uri == null) {
+        throw StateError('Unable to convert path to URI: $path');
+      }
 
-      var source = _sourceFactory.forUri2(uri)!;
+      var source = _sourceFactory.forUri2(uri);
+      if (source == null) {
+        throw StateError('Unable to resolve URI: $uri, path: $path');
+      }
+
       var workspacePackage = _workspace.findPackageFor(path);
       var featureSet = contextFeatureSet(path, uri, workspacePackage);
       var packageLanguageVersion =
diff --git a/pkg/analyzer/lib/src/file_system/file_system.dart b/pkg/analyzer/lib/src/file_system/file_system.dart
index d3d9189..16c7b2a 100644
--- a/pkg/analyzer/lib/src/file_system/file_system.dart
+++ b/pkg/analyzer/lib/src/file_system/file_system.dart
@@ -18,13 +18,13 @@
   ResourceProvider get provider => _provider;
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     if (!isFileUri(uri)) {
       return null;
     }
     String path = fileUriToNormalizedPath(_provider.pathContext, uri);
     File file = _provider.getFile(path);
-    return file.createSource(actualUri ?? uri);
+    return file.createSource(uri);
   }
 
   @override
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index 012b9ac..8d0ed8b 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -883,13 +883,10 @@
   void _validateSizeOfAnnotation(
       AstNode errorNode, NodeList<Annotation> annotations) {
     final ffiSizeAnnotations = annotations.where((annotation) {
-      if (!_isDartFfiElement(annotation.element)) {
-        return false;
-      }
-      if (annotation.element is! ConstructorElement) {
-        return false;
-      }
-      return annotation.element?.enclosingElement?.name == 'CArraySize';
+      final element = annotation.element;
+      return element is ConstructorElement &&
+          _isDartFfiElement(element) &&
+          element.enclosingElement.name == 'CArraySize';
     }).toList();
 
     if (ffiSizeAnnotations.isEmpty) {
diff --git a/pkg/analyzer/lib/src/generated/source.dart b/pkg/analyzer/lib/src/generated/source.dart
index c90e2cf..1d59f76 100644
--- a/pkg/analyzer/lib/src/generated/source.dart
+++ b/pkg/analyzer/lib/src/generated/source.dart
@@ -137,7 +137,7 @@
   DartSdk get dartSdk => _sdk;
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     if (!isDartUri(uri)) {
       return null;
     }
@@ -524,15 +524,10 @@
   /// Clear any cached URI resolution information.
   void clearCache() {}
 
-  /// Resolve the given absolute URI. Return a [Source] representing the file to
-  /// which it was resolved, whether or not the resulting source exists, or
+  /// Resolve the given absolute [uri]. Return a [Source] representing the file
+  /// to which it was resolved, whether or not the resulting source exists, or
   /// `null` if it could not be resolved because the URI is invalid.
-  ///
-  /// @param uri the URI to be resolved
-  /// @param actualUri the actual uri for this source -- if `null`, the value of
-  /// [uri] will be used
-  /// @return a [Source] representing the file to which given URI was resolved
-  Source? resolveAbsolute(Uri uri, [Uri actualUri]);
+  Source? resolveAbsolute(Uri uri);
 
   /// Return an absolute URI that represents the given [source], or `null` if a
   /// valid URI cannot be computed.
diff --git a/pkg/analyzer/lib/src/source/custom_resolver.dart b/pkg/analyzer/lib/src/source/custom_resolver.dart
index f96fdc3..c7fabf8 100644
--- a/pkg/analyzer/lib/src/source/custom_resolver.dart
+++ b/pkg/analyzer/lib/src/source/custom_resolver.dart
@@ -13,7 +13,7 @@
   CustomUriResolver(this.resourceProvider, this._urlMappings);
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     var mapping = _urlMappings[uri.toString()];
     if (mapping == null) {
       return null;
@@ -24,6 +24,6 @@
     }
     var pathContext = resourceProvider.pathContext;
     var path = fileUriToNormalizedPath(pathContext, fileUri);
-    return resourceProvider.getFile(path).createSource(actualUri ?? uri);
+    return resourceProvider.getFile(path).createSource(uri);
   }
 }
diff --git a/pkg/analyzer/lib/src/source/package_map_resolver.dart b/pkg/analyzer/lib/src/source/package_map_resolver.dart
index 6ac9fa4..86bf901 100644
--- a/pkg/analyzer/lib/src/source/package_map_resolver.dart
+++ b/pkg/analyzer/lib/src/source/package_map_resolver.dart
@@ -39,7 +39,7 @@
   }
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     if (!isPackageUri(uri)) {
       return null;
     }
diff --git a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
index 786fbc5..adff68e 100644
--- a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
@@ -95,12 +95,11 @@
   InSummaryUriResolver(this.resourceProvider, this._dataStore);
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
-    actualUri ??= uri;
+  Source? resolveAbsolute(Uri uri) {
     String uriString = uri.toString();
     String? summaryPath = _dataStore.uriToSummaryPath[uriString];
     if (summaryPath != null) {
-      return InSummarySource(actualUri, summaryPath);
+      return InSummarySource(uri, summaryPath);
     }
     return null;
   }
diff --git a/pkg/analyzer/lib/src/workspace/bazel.dart b/pkg/analyzer/lib/src/workspace/bazel.dart
index d02f16b..3d6a1e8 100644
--- a/pkg/analyzer/lib/src/workspace/bazel.dart
+++ b/pkg/analyzer/lib/src/workspace/bazel.dart
@@ -63,14 +63,14 @@
         super(workspace.provider);
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     if (!ResourceUriResolver.isFileUri(uri)) {
       return null;
     }
     String filePath = fileUriToNormalizedPath(provider.pathContext, uri);
     var file = workspace.findFile(filePath);
     if (file != null) {
-      return file.createSource(actualUri ?? uri);
+      return file.createSource(uri);
     }
     return null;
   }
@@ -228,7 +228,7 @@
   }
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     var source = _sourceCache[uri];
     if (source == null) {
       source = _resolveAbsolute(uri);
@@ -271,7 +271,7 @@
     if (uri.scheme != 'package') {
       return null;
     }
-    String uriPath = uri.path;
+    String uriPath = Uri.decodeComponent(uri.path);
     int slash = uriPath.indexOf('/');
 
     // If the path either starts with a slash or has no slash, it is invalid.
diff --git a/pkg/analyzer/lib/src/workspace/package_build.dart b/pkg/analyzer/lib/src/workspace/package_build.dart
index 5b49691..298ab1b 100644
--- a/pkg/analyzer/lib/src/workspace/package_build.dart
+++ b/pkg/analyzer/lib/src/workspace/package_build.dart
@@ -27,7 +27,7 @@
         super(workspace.provider);
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     if (!ResourceUriResolver.isFileUri(uri)) {
       return null;
     }
@@ -38,7 +38,7 @@
     }
     var file = workspace.findFile(filePath);
     if (file != null) {
-      return file.createSource(actualUri ?? uri);
+      return file.createSource(uri);
     }
     return null;
   }
@@ -59,8 +59,7 @@
   Map<String, List<Folder>> get packageMap => _workspace._packageMap;
 
   @override
-  Source? resolveAbsolute(Uri _ignore, [Uri? uri]) {
-    uri ??= _ignore;
+  Source? resolveAbsolute(Uri uri) {
     if (uri.scheme != 'package') {
       return null;
     }
diff --git a/pkg/analyzer/test/generated/source_factory_test.dart b/pkg/analyzer/test/generated/source_factory_test.dart
index b6d31f4..196e8b2 100644
--- a/pkg/analyzer/test/generated/source_factory_test.dart
+++ b/pkg/analyzer/test/generated/source_factory_test.dart
@@ -27,10 +27,10 @@
   AbsoluteUriResolver(this.resourceProvider);
 
   @override
-  Source resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source resolveAbsolute(Uri uri) {
     return FileSource(
         resourceProvider.getFile(resourceProvider.pathContext.fromUri(uri)),
-        actualUri);
+        uri);
   }
 }
 
@@ -115,7 +115,7 @@
   UriResolver_absolute();
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     invoked = true;
     return null;
   }
@@ -127,7 +127,7 @@
   UriResolver_restoreUri(this.source1, this.expected1);
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) => null;
+  Source? resolveAbsolute(Uri uri) => null;
 
   @override
   Uri? restoreAbsolute(Source source) {
@@ -144,7 +144,7 @@
   UriResolver_SourceFactoryTest_test_fromEncoding_valid(this.encoding);
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     if (uri.toString() == encoding) {
       return TestSource();
     }
diff --git a/pkg/analyzer/test/src/dart/analysis/base.dart b/pkg/analyzer/test/src/dart/analysis/base.dart
index 23722e1..ea7e629 100644
--- a/pkg/analyzer/test/src/dart/analysis/base.dart
+++ b/pkg/analyzer/test/src/dart/analysis/base.dart
@@ -154,7 +154,7 @@
 }
 
 class _GeneratedUriResolverMock implements UriResolver {
-  Source? Function(Uri, Uri?)? resolveAbsoluteFunction;
+  Source? Function(Uri)? resolveAbsoluteFunction;
 
   Uri? Function(Source)? restoreAbsoluteFunction;
 
@@ -167,9 +167,9 @@
   }
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     if (resolveAbsoluteFunction != null) {
-      return resolveAbsoluteFunction!(uri, actualUri);
+      return resolveAbsoluteFunction!(uri);
     }
     return null;
   }
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 1430912..4c74215 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -1105,8 +1105,7 @@
 
     Source generatedSource = _SourceMock(generatedPath, uri);
 
-    generatedUriResolver.resolveAbsoluteFunction =
-        (uri, actualUri) => generatedSource;
+    generatedUriResolver.resolveAbsoluteFunction = (uri) => generatedSource;
     generatedUriResolver.restoreAbsoluteFunction = (Source source) {
       String path = source.fullName;
       if (path == templatePath || path == generatedPath) {
@@ -2997,7 +2996,7 @@
 
     // Configure UriResolver to provide this generated file.
     generatedUriResolver.resolveAbsoluteFunction =
-        (uri, actualUri) => aGeneratedFile.createSource(actualUri);
+        (uri) => aGeneratedFile.createSource(uri);
     generatedUriResolver.restoreAbsoluteFunction = (source) {
       String path = source.fullName;
       if (path == a || path == aGeneratedPath) {
diff --git a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
index d96d07f..024c895 100644
--- a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
@@ -415,8 +415,7 @@
 
     Source generatedSource = _SourceMock(generatedPath, uri);
 
-    generatedUriResolver.resolveAbsoluteFunction =
-        (uri, actualUri) => generatedSource;
+    generatedUriResolver.resolveAbsoluteFunction = (uri) => generatedSource;
 
     expect(fileSystemState.hasUri(templatePath), isFalse);
     expect(fileSystemState.hasUri(generatedPath), isTrue);
@@ -700,7 +699,7 @@
 }
 
 class _GeneratedUriResolverMock implements UriResolver {
-  Source? Function(Uri, Uri?)? resolveAbsoluteFunction;
+  Source? Function(Uri)? resolveAbsoluteFunction;
 
   Uri? Function(Source)? restoreAbsoluteFunction;
 
@@ -710,9 +709,9 @@
   }
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     if (resolveAbsoluteFunction != null) {
-      return resolveAbsoluteFunction!(uri, actualUri);
+      return resolveAbsoluteFunction!(uri);
     }
     return null;
   }
diff --git a/pkg/analyzer/test/src/workspace/bazel_test.dart b/pkg/analyzer/test/src/workspace/bazel_test.dart
index 07dee14..fe83186 100644
--- a/pkg/analyzer/test/src/workspace/bazel_test.dart
+++ b/pkg/analyzer/test/src/workspace/bazel_test.dart
@@ -473,6 +473,17 @@
         exists: true);
   }
 
+  void test_resolveAbsolute_workspace_exists_hasSpace() {
+    _addResources([
+      '/workspace/WORKSPACE',
+      '/workspace/bazel-genfiles/',
+      '/workspace/my/foo/lib/foo .dart',
+    ]);
+    _assertResolve(
+        'package:my.foo/foo .dart', '/workspace/my/foo/lib/foo .dart',
+        exists: true, restore: false);
+  }
+
   void test_restoreAbsolute_noPackageName_workspace() {
     _addResources([
       '/workspace/WORKSPACE',
diff --git a/pkg/analyzer/test/src/workspace/package_build_test.dart b/pkg/analyzer/test/src/workspace/package_build_test.dart
index dbc0e58..7531186 100644
--- a/pkg/analyzer/test/src/workspace/package_build_test.dart
+++ b/pkg/analyzer/test/src/workspace/package_build_test.dart
@@ -31,7 +31,7 @@
   noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
 
   @override
-  Source? resolveAbsolute(Uri uri, [Uri? actualUri]) {
+  Source? resolveAbsolute(Uri uri) {
     return uriToFile[uri]?.createSource(uri);
   }
 
diff --git a/pkg/analyzer_cli/lib/src/build_mode.dart b/pkg/analyzer_cli/lib/src/build_mode.dart
index c015730..5223b4a 100644
--- a/pkg/analyzer_cli/lib/src/build_mode.dart
+++ b/pkg/analyzer_cli/lib/src/build_mode.dart
@@ -629,8 +629,8 @@
       this.inSummaryUriResolver, this.dependencyTracker);
 
   @override
-  Source resolveAbsolute(Uri uri, [Uri actualUri]) {
-    var source = inSummaryUriResolver.resolveAbsolute(uri, actualUri);
+  Source resolveAbsolute(Uri uri) {
+    var source = inSummaryUriResolver.resolveAbsolute(uri);
     if (dependencyTracker != null &&
         source != null &&
         source is InSummarySource) {
diff --git a/pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart b/pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart
index b4a9e25..bf21e4a 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart
@@ -111,6 +111,11 @@
   /// invoked [ExecutableElement], otherwise this is `null`.
   ExecutableElement _executableElement;
 
+  /// If the target is in an argument list of a [FunctionExpressionInvocation],
+  /// then this is the static type of the function being invoked, otherwise this
+  /// is `null`.
+  FunctionType _functionType;
+
   /// If the target is an argument in an [ArgumentList], then this is the
   /// corresponding [ParameterElement] in the invoked [ExecutableElement],
   /// otherwise this is `null`.
@@ -270,6 +275,32 @@
     return _executableElement;
   }
 
+  /// If the target is in an argument list of a [FunctionExpressionInvocation],
+  /// then this is the static type of the function being invoked, otherwise this
+  /// is `null`.
+  FunctionType get functionType {
+    if (_functionType == null) {
+      var argumentList = containingNode;
+      if (argumentList is NamedExpression) {
+        argumentList = argumentList.parent;
+      }
+      if (argumentList is! ArgumentList) {
+        return null;
+      }
+
+      var invocation = argumentList.parent;
+
+      if (invocation is FunctionExpressionInvocation) {
+        final invokeType = invocation.staticInvokeType;
+        if (invokeType is FunctionType) {
+          _functionType = invokeType;
+        }
+      }
+    }
+
+    return _functionType;
+  }
+
   /// Return `true` if the [containingNode] is a cascade
   /// and the completion insertion is not between the two dots.
   /// For example, `..d^` and `..^d` are considered a cascade
diff --git a/tools/VERSION b/tools/VERSION
index 101e3cf..672d7fb 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 13
 PATCH 0
-PRERELEASE 21
+PRERELEASE 22
 PRERELEASE_PATCH 0
\ No newline at end of file