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 91541323a8df0568de33fadcfa1434d60a80157c..4d36ec9b39c2a8e15229c3e88b5b79d2ce5ca3fa 100644 |
--- a/pkg/analyzer/lib/src/generated/type_system.dart |
+++ b/pkg/analyzer/lib/src/generated/type_system.dart |
@@ -142,6 +142,23 @@ class StrongTypeSystemImpl extends TypeSystem { |
} |
/** |
+ * Compute the least upper bound of two types. |
+ */ |
+ @override |
+ DartType getLeastUpperBound( |
+ TypeProvider typeProvider, DartType type1, DartType type2) { |
+ // The least upper bound of bottom and any nonnullable type T is dynamic. |
+ if (type1.isBottom && isNonNullableType(type2)) { |
Leaf
2016/08/03 23:45:07
This depends a bit on exactly what system you are
stanm
2016/08/04 00:31:15
Thanks for the detailed explanation.
If by 'My gu
Leaf
2016/08/04 19:40:36
Looks right to me. LNST(T)? == LNST(T), I think,
|
+ return typeProvider.dynamicType; |
+ } |
+ if (type2.isBottom && isNonNullableType(type1)) { |
+ return typeProvider.dynamicType; |
+ } |
+ return super.getLeastUpperBound(typeProvider, type1, type2); |
+ } |
+ |
+ |
+ /** |
* Given a generic function type `F<T0, T1, ... Tn>` and a context type C, |
* infer an instantiation of F, such that `F<S0, S1, ..., Sn>` <: C. |
* |