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

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

Issue 2288393002: Simplify the bailout test for generic inference (Closed)
Patch Set: Created 4 years, 4 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 | no next file » | 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 1abf232d518fffbe778f29b558fdeb9853f5e3e3..454991c9eaa911fcdcf4bffc0032aaabdd3e77e0 100644
--- a/pkg/analyzer/lib/src/generated/type_system.dart
+++ b/pkg/analyzer/lib/src/generated/type_system.dart
@@ -1426,17 +1426,9 @@ class _StrongInferenceTypeSystem extends StrongTypeSystemImpl {
inferredTypes[i] =
variance.passedIn || bound.lower.isBottom ? bound.upper : bound.lower;
- // See if the constraints on the type variable are satisfied.
- //
- // If not, bail out of the analysis, unless a partial solution was
- // requested. If we are willing to accept a partial solution, fall back to
- // the known upper bound (if any) or `dynamic` for this unsolvable type
- // variable.
- if (inferredTypes[i].isBottom ||
- !isSubtypeOf(inferredTypes[i],
- bound.upper.substitute2(inferredTypes, fnTypeParams)) ||
- !isSubtypeOf(bound.lower.substitute2(inferredTypes, fnTypeParams),
- inferredTypes[i])) {
+ // See if the bounds can be satisfied.
+ if (bound.upper.isBottom ||
+ !_typeSystem.isSubtypeOf(bound.lower, bound.upper)) {
// Inference failed. Bail.
return null;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698