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

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

Issue 2773523002: Fix for a new infinite cycle in InterfaceTypeImpl.substitute2(). (Closed)
Patch Set: Created 3 years, 9 months 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/test/src/dart/analysis/driver_test.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 0a47f064287c0204c1b91c4d2b85d50ebca847cf..da017f5d5c4bff17daebc8b8c9bb2b7bbb0eb6fb 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -2036,6 +2036,20 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
if (argumentTypes.length == 0 || typeArguments.length == 0) {
return this.pruned(prune);
}
+
+ // If every parameter type is equal to the corresponding argument type,
+ // then the type will not change. Return it as is.
+ bool isIdentityTransformation = true;
+ for (int i = 0; i < parameterTypes.length; i++) {
+ if (parameterTypes[i] != argumentTypes[i]) {
+ isIdentityTransformation = false;
+ break;
+ }
+ }
+ if (isIdentityTransformation) {
+ return this;
+ }
+
List<DartType> newTypeArguments = TypeImpl.substitute(
typeArguments, argumentTypes, parameterTypes, prune);
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698