| Index: pkg/analyzer/lib/src/generated/type_system.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/type_system.dart b/pkg/analyzer/lib/src/generated/type_system.dart
|
| index f34e7e67fda6049ce5bf5af7d85e1c24fce63d83..7e4103d9e10266574e2830246831c51f9d151ecc 100644
|
| --- a/pkg/analyzer/lib/src/generated/type_system.dart
|
| +++ b/pkg/analyzer/lib/src/generated/type_system.dart
|
| @@ -73,7 +73,6 @@ class StrongTypeSystemImpl extends TypeSystem {
|
| }
|
|
|
| /// Computes the greatest lower bound of [type1] and [type2].
|
| - @override
|
| DartType getGreatestLowerBound(
|
| TypeProvider provider, DartType type1, DartType type2) {
|
| // The greatest lower bound relation is reflexive.
|
| @@ -208,16 +207,16 @@ class StrongTypeSystemImpl extends TypeSystem {
|
| // We don't have union types, so Future<T>.then<S> is typed to take a
|
| // callback `T -> S`. However, the lambda might actually return a
|
| // Future<S>. So we handle that special case here.
|
| - Element element = fnType?.element;
|
| - bool isFutureThen = element is MethodElement &&
|
| - element.name == 'then' &&
|
| - element.enclosingElement.type.isDartAsyncFuture;
|
| - if (isFutureThen &&
|
| - argumentTypes.isNotEmpty &&
|
| - argumentTypes[0] is FunctionType) {
|
| - // Ignore return context. We'll let the onValue function's return type
|
| - // drive inference.
|
| - returnContextType = null;
|
| + if (argumentTypes.isNotEmpty && argumentTypes[0] is FunctionType) {
|
| + Element element = fnType?.element;
|
| + bool isFutureThen = element is MethodElement &&
|
| + element.name == 'then' &&
|
| + element.enclosingElement.type.isDartAsyncFuture;
|
| + if (isFutureThen) {
|
| + // Ignore return context. We'll let the onValue function's return type
|
| + // drive inference.
|
| + returnContextType = null;
|
| + }
|
| }
|
|
|
| if (returnContextType != null) {
|
|
|