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

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

Issue 47513007: Fix the more specific relation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase + fix test/status Created 7 years, 2 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 | sdk/lib/_internal/compiler/implementation/typechecker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/dart_types.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_types.dart b/sdk/lib/_internal/compiler/implementation/dart_types.dart
index ff98bd457eed8c662265de424075c0ed40e88e9d..b6d3234f3258d9d6ba55e8a303bb6028029209d4 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_types.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_types.dart
@@ -1121,12 +1121,16 @@ class MoreSpecificVisitor extends AbstractTypeRelation {
: super(compiler, dynamicType, voidType);
bool isMoreSpecific(DartType t, DartType s) {
- if (identical(t, s) ||
- t.treatAsDynamic ||
- identical(s.element, compiler.objectClass) ||
+ if (identical(t, s) || s.treatAsDynamic ||
identical(t.element, compiler.nullClass)) {
return true;
}
+ if (t.treatAsDynamic) {
+ return false;
+ }
+ if (identical(s.element, compiler.objectClass)) {
+ return true;
+ }
t = t.unalias(compiler);
s = s.unalias(compiler);
@@ -1138,6 +1142,7 @@ class MoreSpecificVisitor extends AbstractTypeRelation {
}
bool invalidFunctionReturnTypes(DartType t, DartType s) {
+ if (s.treatAsDynamic && t.isVoid) return true;
return !s.isVoid && !isMoreSpecific(t, s);
}
@@ -1161,7 +1166,7 @@ class SubtypeVisitor extends MoreSpecificVisitor {
: super(compiler, dynamicType, voidType);
bool isSubtype(DartType t, DartType s) {
- return s.treatAsDynamic || isMoreSpecific(t, s);
+ return t.treatAsDynamic || isMoreSpecific(t, s);
}
bool isAssignable(DartType t, DartType s) {
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698