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 f68e0317aa31697af4a226edb8419b711d6ef6fa..1da3b38572a2ece3bc26caad898bad81f172a839 100644 |
--- a/pkg/analyzer/lib/src/generated/type_system.dart |
+++ b/pkg/analyzer/lib/src/generated/type_system.dart |
@@ -566,6 +566,15 @@ abstract class TypeSystem { |
TypeProvider typeProvider, DartType type1, DartType type2); |
/** |
+ * Given a [function] type, instantiate it with its bounds. |
+ * |
+ * The behavior of this method depends on the type system, for example, in |
+ * classic Dart `dynamic` will be used for all type arguments, whereas |
+ * strong mode prefers the actual bound type if it was specified. |
+ */ |
+ FunctionType instantiateToBounds(FunctionType function); |
+ |
+ /** |
* Return `true` if the [leftType] is assignable to the [rightType] (that is, |
* if leftType <==> rightType). |
*/ |
@@ -673,6 +682,18 @@ class TypeSystemImpl implements TypeSystem { |
} |
} |
+ /** |
+ * Instantiate the function type using `dynamic` for all generic parameters. |
+ */ |
+ FunctionType instantiateToBounds(FunctionType function) { |
+ int count = function.boundTypeParameters.length; |
+ if (count == 0) { |
+ return function; |
+ } |
+ return function.instantiate( |
+ new List<DartType>.filled(count, DynamicTypeImpl.instance)); |
+ } |
+ |
@override |
bool isAssignableTo(DartType leftType, DartType rightType) { |
return leftType.isAssignableTo(rightType); |