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

Unified Diff: pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart

Issue 2883083002: Make type inference handle overloaded arithmetic operations. (Closed)
Patch Set: Created 3 years, 7 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/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart b/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
index f08da1ced68551c02d24d30a471c56a7a7205595..3165a2449736cdd067c59477573e858cd0917daf 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_schema_environment.dart
@@ -158,6 +158,18 @@ class TypeSchemaEnvironment extends TypeEnvironment {
return const DynamicType();
}
+ @override
+ DartType getTypeOfOverloadedArithmetic(DartType type1, DartType type2) {
+ // TODO(paulberry): this matches what is defined in the spec. It would be
+ // nice if we could change kernel to match the spec and not have to
+ // override.
+ if (type1 == intType) {
+ if (type2 == intType) return type2;
+ if (type2 == doubleType) return type2;
+ }
+ return numType;
+ }
+
/// Infers a generic type, function, method, or list/map literal
/// instantiation, using the downward context type as well as the argument
/// types if available.
« no previous file with comments | « pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart ('k') | pkg/front_end/test/fasta/kompile.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698