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

Unified Diff: sdk/lib/_internal/compiler/implementation/typechecker.dart

Issue 52263003: Implement least upper bound. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 1 month 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: sdk/lib/_internal/compiler/implementation/typechecker.dart
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index d060765e05196e70d83e73026d7ba1507e529773..a63e229d19a4faff0481cc521c3b0d410760e30c 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -1422,13 +1422,7 @@ class TypeCheckerVisitor extends Visitor<DartType> {
DartType thenType = analyzeInPromotedContext(condition, thenExpression);
DartType elseType = analyzeNonVoid(node.elseExpression);
- if (types.isSubtype(thenType, elseType)) {
- return thenType;
- } else if (types.isSubtype(elseType, thenType)) {
- return elseType;
- } else {
- return objectType;
- }
+ return compiler.types.computeLeastUpperBound(thenType, elseType);
}
visitStringInterpolation(StringInterpolation node) {

Powered by Google App Engine
This is Rietveld 408576698