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 6fe292ae7bb080e3ab0050adf1156820a35d321f..8fff9629095c869cf432e34472874a75caf485fd 100644 |
--- a/pkg/analyzer/lib/src/generated/resolver.dart |
+++ b/pkg/analyzer/lib/src/generated/resolver.dart |
@@ -10706,6 +10706,11 @@ class ResolverVisitor extends ScopedVisitor { |
@override |
Object visitDefaultFormalParameter(DefaultFormalParameter node) { |
super.visitDefaultFormalParameter(node); |
+ ParameterElement element = node.element; |
+ if (element.initializer != null && node.defaultValue != null) { |
+ (element.initializer as FunctionElementImpl).returnType = |
+ node.defaultValue.staticType; |
+ } |
FormalParameterList parent = node.parent; |
AstNode grandparent = parent.parent; |
if (grandparent is ConstructorDeclaration && |
@@ -11131,6 +11136,10 @@ class ResolverVisitor extends ScopedVisitor { |
Object visitVariableDeclaration(VariableDeclaration node) { |
super.visitVariableDeclaration(node); |
VariableElement element = node.element; |
+ if (element.initializer != null && node.initializer != null) { |
+ (element.initializer as FunctionElementImpl).returnType = |
+ node.initializer.staticType; |
+ } |
// Note: in addition to cloning the initializers for const variables, we |
// have to clone the initializers for non-static final fields (because if |
// they occur in a class with a const constructor, they will be needed to |
@@ -14673,6 +14682,12 @@ abstract class TypeSystem { |
* Compute the least upper bound of two types. |
*/ |
DartType getLeastUpperBound(DartType type1, DartType type2); |
+ |
+ /** |
+ * Return `true` if the [leftType] is a subtype of the [rightType] (that is, |
+ * if leftType <: rightType). |
+ */ |
+ bool isSubtypeOf(DartType leftType, DartType rightType); |
} |
/** |
@@ -14762,6 +14777,11 @@ class TypeSystemImpl implements TypeSystem { |
return typeProvider.dynamicType; |
} |
} |
+ |
+ @override |
+ bool isSubtypeOf(DartType leftType, DartType rightType) { |
+ return leftType.isSubtypeOf(rightType); |
+ } |
} |
/** |