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

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

Issue 1609093003: fixes #25482, flatten Futures in strong mode so Future.then works (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
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 5eb00ee385d3c67024d4c5f5bd9afdc82ecf54d9..b85205c14911c99f52cac721d098a731e4500744 100644
--- a/pkg/analyzer/lib/src/generated/type_system.dart
+++ b/pkg/analyzer/lib/src/generated/type_system.dart
@@ -32,6 +32,9 @@ class StrongTypeSystemImpl implements TypeSystem {
@override
bool canPromoteToType(DartType to, DartType from) => isSubtypeOf(to, from);
+ @override
+ bool isMoreSpecificThan(DartType t1, DartType t2) => isSubtypeOf(t1, t2);
+
/**
* Given a type t, if t is an interface type with a call method
* defined, return the function type for the call method, otherwise
@@ -569,13 +572,22 @@ abstract class TypeSystem {
* Returns `true` if we can promote to the first type from the second type.
*
* In the standard Dart type system, it is not possible to promote from or to
- * `dynamic`, and we must be promoting to a more specific type.
+ * `dynamic`, and we must be promoting to a more specific type, see
+ * [isMoreSpecificThan].
*
* In strong mode, this is equivalent to [isSubtypeOf].
*/
bool canPromoteToType(DartType to, DartType from);
/**
+ * Return `true` if the [leftType] is more specific than the [rightType]
+ * (that is, if leftType << rightType), as defined in the Dart language spec.
+ *
+ * In strong mode, this is equivalent to [isSubtypeOf].
+ */
+ bool isMoreSpecificThan(DartType leftType, DartType rightType);
+
+ /**
* Compute the least upper bound of two types.
*/
DartType getLeastUpperBound(
@@ -619,6 +631,10 @@ class TypeSystemImpl implements TypeSystem {
TypeSystemImpl();
@override
+ bool isMoreSpecificThan(DartType t1, DartType t2) =>
+ t1.isMoreSpecificThan(t2);
+
+ @override
bool canPromoteToType(DartType to, DartType from) {
// Declared type should not be "dynamic".
// Promoted type should not be "dynamic".

Powered by Google App Engine
This is Rietveld 408576698