Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(937)

Unified Diff: pkg/analyzer/lib/src/generated/type_system.dart

Issue 1514683002: fix #25183, add support to ErrorVerifier for generic methods (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698