| Index: pkg/analyzer/lib/src/generated/resolver.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
|
| index cec835498ebd710d9abd819f8f3d5b0ce5811125..71d2e7b9ee3e69c16de835b4b74fadfe759730eb 100644
|
| --- a/pkg/analyzer/lib/src/generated/resolver.dart
|
| +++ b/pkg/analyzer/lib/src/generated/resolver.dart
|
| @@ -5758,6 +5758,18 @@ class ResolverVisitor extends ScopedVisitor {
|
| }
|
|
|
| /**
|
| + * Returns true if this method is `Future.then`.
|
| + *
|
| + * If so we will apply special typing rules in strong mode, to handle the
|
| + * implicit union of `S | Future<S>`
|
| + */
|
| + bool isFutureThen(Element element) {
|
| + return element is MethodElement &&
|
| + element.name == 'then' &&
|
| + element.enclosingElement.type.isDartAsyncFuture;
|
| + }
|
| +
|
| + /**
|
| * Given a downward inference type [fnType], and the declared
|
| * [typeParameterList] for a function expression, determines if we can enable
|
| * downward inference and if so, returns the function type to use for
|
| @@ -6583,7 +6595,7 @@ class ResolverVisitor extends ScopedVisitor {
|
| _inferFormalParameterList(node.parameters, functionType);
|
|
|
| DartType returnType;
|
| - if (_isFutureThenLambda(node)) {
|
| + if (isFutureThen(node.staticParameterElement?.enclosingElement)) {
|
| var futureThenType =
|
| InferenceContext.getContext(node.parent) as FunctionType;
|
|
|
| @@ -7394,19 +7406,6 @@ class ResolverVisitor extends ScopedVisitor {
|
| }
|
|
|
| /**
|
| - * Returns true if this expression is being passed to `Future.then`.
|
| - *
|
| - * If so we will apply special typing rules in strong mode, to handle the
|
| - * implicit union of `S | Future<S>`
|
| - */
|
| - bool _isFutureThenLambda(FunctionExpression node) {
|
| - Element element = node.staticParameterElement?.enclosingElement;
|
| - return element is MethodElement &&
|
| - element.name == 'then' &&
|
| - element.enclosingElement.type.isDartAsyncFuture;
|
| - }
|
| -
|
| - /**
|
| * Return `true` if the given variable is accessed within a closure in the given
|
| * [AstNode] and also mutated somewhere in variable scope. This information is only
|
| * available for local variables (including parameters).
|
|
|