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

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

Issue 2757813002: don't produce errors from inference for downward inferred type variables (Closed)
Patch Set: fix test expectation 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/generated/strong_mode_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 595d1a0afa0c9ae5408ecf94c021532e23b21fcc..33548259cadef81471ddcbf4f6a027c53e4db0d8 100644
--- a/pkg/analyzer/lib/src/generated/type_system.dart
+++ b/pkg/analyzer/lib/src/generated/type_system.dart
@@ -1916,12 +1916,15 @@ class _GenericInferrer {
}
DartType _inferTypeParameterFromAll(
- Iterable<_TypeConstraint> constraints, _TypeConstraint extendsClause) {
+ List<_TypeConstraint> constraints, _TypeConstraint extendsClause) {
// See if we already fixed this type from downwards inference.
// If so, then we aren't allowed to change it based on argument types.
DartType t = _inferTypeParameterFromContext(
constraints.where((c) => c.isDownwards), extendsClause);
if (UnknownInferredType.isKnown(t)) {
+ // Remove constraints that aren't downward ones; we'll ignore these for
+ // error reporting, because inference already succeeded.
+ constraints.removeWhere((c) => !c.isDownwards);
return t;
}
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/strong_mode_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698