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

Unified Diff: pkg/analyzer/lib/src/dart/element/type.dart

Issue 2540903003: restrict generic function type subtyping (Closed)
Patch Set: patch Created 4 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 | « no previous file | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/element/type.dart
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index bf898e0e6a951804cfef9e06697f9c7beceb6c1c..32a12a59ae540f02077b3229773710ac3fe008d0 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -1026,16 +1026,12 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
// This type cast is safe, because we checked it above.
FunctionType s = other as FunctionType;
if (t.typeFormals.isNotEmpty) {
- if (s.typeFormals.isEmpty) {
- t = instantiateToBounds(t);
- } else {
- List<DartType> freshVariables = relateTypeFormals(t, s, returnRelation);
- if (freshVariables == null) {
- return false;
- }
- t = t.instantiate(freshVariables);
- s = s.instantiate(freshVariables);
+ List<DartType> freshVariables = relateTypeFormals(t, s, returnRelation);
+ if (freshVariables == null) {
+ return false;
}
+ t = t.instantiate(freshVariables);
+ s = s.instantiate(freshVariables);
} else if (s.typeFormals.isNotEmpty) {
return false;
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698