| 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 d4da3a0b49d0ddb0f63dcfcd989b960119cb9f26..76acec6f78f02f5a1898b208cfb0ffd40a7d9706 100644
|
| --- a/pkg/analyzer/lib/src/generated/resolver.dart
|
| +++ b/pkg/analyzer/lib/src/generated/resolver.dart
|
| @@ -5170,30 +5170,6 @@ class ResolverVisitor extends ScopedVisitor {
|
| }
|
|
|
| /**
|
| - * Returns true if this method is `Future.then` or an override thereof.
|
| - *
|
| - * If so we will apply special typing rules in strong mode, to handle the
|
| - * implicit union of `S | Future<S>`
|
| - */
|
| - // TODO(leafp): Eliminate this when code is switched to using FutureOr
|
| - bool isFutureThen(Element element) {
|
| - // If we are a method named then
|
| - if (element is MethodElement && element.name == 'then') {
|
| - DartType type = element.enclosingElement.type;
|
| - // On Future or a subtype, then we're good.
|
| - return (type.isDartAsyncFuture || isSubtypeOfFuture(type));
|
| - }
|
| - return false;
|
| - }
|
| -
|
| - /**
|
| - * Returns true if this type is any subtype of the built in Future type.
|
| - */
|
| - // TODO(leafp): Eliminate this when code is switched to using FutureOr
|
| - bool isSubtypeOfFuture(DartType type) =>
|
| - typeSystem.isSubtypeOf(type, typeProvider.futureDynamicType);
|
| -
|
| - /**
|
| * 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
|
| @@ -6031,26 +6007,8 @@ class ResolverVisitor extends ScopedVisitor {
|
| matchFunctionTypeParameters(node.typeParameters, functionType);
|
| if (functionType is FunctionType) {
|
| _inferFormalParameterList(node.parameters, functionType);
|
| - DartType returnType;
|
| - ParameterElement parameterElement =
|
| - resolutionMap.staticParameterElementForExpression(node);
|
| - if (isFutureThen(parameterElement?.enclosingElement)) {
|
| - var futureThenType =
|
| - InferenceContext.getContext(node.parent) as FunctionType;
|
| -
|
| - // TODO(leafp): Get rid of this once code has been updated to use
|
| - // FutureOr
|
| - // Introduce FutureOr<T> for backwards compatibility if it was
|
| - // missing in old code.
|
| - if (futureThenType.parameters.isNotEmpty) {
|
| - if (!futureThenType.parameters[0].type.isDartAsyncFutureOr) {
|
| - var typeParamS = futureThenType.returnType.flattenFutures(ts);
|
| - returnType = _createFutureOr(typeParamS);
|
| - }
|
| - }
|
| - }
|
| - returnType ??= _computeReturnOrYieldType(functionType.returnType);
|
| - InferenceContext.setType(node.body, returnType);
|
| + InferenceContext.setType(
|
| + node.body, _computeReturnOrYieldType(functionType.returnType));
|
| }
|
| }
|
| super.visitFunctionExpression(node);
|
|
|