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

Unified Diff: pkg/analyzer/test/src/task/strong/inferred_type_test.dart

Issue 1950983004: Issue 25914. Refine type of 'T + T' when 'T extends num' to 'T' in strong mode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/type_system.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/inferred_type_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
index 38b37cbe8f155e74252983a8020782a3c773c9b1..cf5f6578da53146eb5fc17f6020f28f7d409015f 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -2104,6 +2104,29 @@ var y = new C().m(1, b: 'bbb', c: 2.0);
expect(unit.topLevelVariables[0].type.toString(), 'double');
}
+ void test_refineBinaryExpressionType_typeParameter() {
+ checkFile('''
+class Point<T extends num> {
+ T x;
+ T y;
+
+ Point(this.x, this.y);
+
+ Point<T> operator +(Point<T> other) {
+ return new Point<T>(x + other.x, y + other.y);
+ }
+
+ Point<T> operator -(Point<T> other) {
+ return new Point<T>(x - other.x, y - other.y);
+ }
+
+ Point<T> operator *(Point<T> other) {
+ return new Point<T>(x * other.x, y * other.y);
+ }
+}
+ ''');
+ }
+
void test_inferGenericMethodType_positional() {
var unit = checkFile('''
class C {
« no previous file with comments | « pkg/analyzer/lib/src/generated/type_system.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698