Index: lib/type_environment.dart |
diff --git a/lib/type_environment.dart b/lib/type_environment.dart |
index 96f6a21a5f9847f98b411e8716f46199fb4ba589..c354c44b7048b5bac5aa22f4942d0b7e57ac3588 100644 |
--- a/lib/type_environment.dart |
+++ b/lib/type_environment.dart |
@@ -206,12 +206,17 @@ abstract class SubtypeTester { |
return false; |
} |
} |
- for (String name in supertype.namedParameters.keys) { |
- var supertypeParameter = supertype.namedParameters[name]; |
- var subtypeParameter = subtype.namedParameters[name]; |
- if (subtypeParameter == null) return false; |
+ int subtypeNameIndex = 0; |
+ for (NamedType supertypeParameter in supertype.namedParameters) { |
+ while (subtypeNameIndex < subtype.namedParameters.length && |
+ subtype.namedParameters[subtypeNameIndex].name != |
+ supertypeParameter.name) { |
+ ++subtypeNameIndex; |
+ } |
+ if (subtypeNameIndex == subtype.namedParameters.length) return false; |
+ NamedType subtypeParameter = subtype.namedParameters[subtypeNameIndex]; |
// Termination: Both types shrink in size. |
- if (!isSubtypeOf(supertypeParameter, subtypeParameter)) { |
+ if (!isSubtypeOf(supertypeParameter.type, subtypeParameter.type)) { |
return false; |
} |
} |