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

Unified Diff: pkg/kernel/lib/type_environment.dart

Issue 2619193003: Insert implicit downcasts in kernel strong mode. (Closed)
Patch Set: Merge Created 3 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
« no previous file with comments | « pkg/kernel/lib/type_checker.dart ('k') | pkg/kernel/lib/verifier.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/type_environment.dart
diff --git a/pkg/kernel/lib/type_environment.dart b/pkg/kernel/lib/type_environment.dart
index c354c44b7048b5bac5aa22f4942d0b7e57ac3588..9bf931828c7896d701c78bb668005161e2977d98 100644
--- a/pkg/kernel/lib/type_environment.dart
+++ b/pkg/kernel/lib/type_environment.dart
@@ -95,7 +95,11 @@ class TypeEnvironment extends SubtypeTester {
Class class_ = member.enclosingClass;
if (class_ == coreTypes.intClass || class_ == coreTypes.numClass) {
String name = member.name.name;
- return name == '+' || name == '-' || name == '*' || name == 'remainder';
+ return name == '+' ||
+ name == '-' ||
+ name == '*' ||
+ name == 'remainder' ||
+ name == '%';
}
return false;
}
@@ -128,7 +132,9 @@ abstract class SubtypeTester {
bool isSubtypeOf(DartType subtype, DartType supertype) {
if (identical(subtype, supertype)) return true;
if (subtype is BottomType) return true;
- if (supertype is DynamicType || supertype == objectType) {
+ if (supertype is DynamicType ||
+ supertype is VoidType ||
+ supertype == objectType) {
return true;
}
if (subtype is InterfaceType && supertype is InterfaceType) {
@@ -194,8 +200,7 @@ abstract class SubtypeTester {
}
subtype = substitute(subtype.withoutTypeParameters, substitution);
}
- if (supertype.returnType is! VoidType &&
- !isSubtypeOf(subtype.returnType, supertype.returnType)) {
+ if (!isSubtypeOf(subtype.returnType, supertype.returnType)) {
return false;
}
for (int i = 0; i < supertype.positionalParameters.length; ++i) {
« no previous file with comments | « pkg/kernel/lib/type_checker.dart ('k') | pkg/kernel/lib/verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698