Index: pkg/analyzer/test/src/task/strong/checker_test.dart |
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart |
index ae8ba3a29286512e5e7081e6664cb95531cfdfd0..bfc01a5bdff16851e71f06dfc7b608af5dda63ac 100644 |
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart |
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart |
@@ -270,7 +270,7 @@ foo() => new A(); |
test() { |
int x = 0; |
x += 5; |
- /*error:STATIC_TYPE_ERROR*/x += /*error:INVALID_ASSIGNMENT*/3.14; |
+ x += /*error:INVALID_ASSIGNMENT*/3.14; |
double y = 0.0; |
y += 5; |
@@ -281,12 +281,12 @@ test() { |
z += 3.14; |
x = /*info:DOWN_CAST_IMPLICIT*/x + z; |
- x += /*info:DOWN_CAST_IMPLICIT*/z; |
+ /*info:DOWN_CAST_IMPLICIT_ASSIGN*/x += z; |
y = y + z; |
y += z; |
dynamic w = 42; |
- x += /*info:DYNAMIC_CAST*/w; |
+ /*info:DOWN_CAST_IMPLICIT_ASSIGN*/x += /*info:DYNAMIC_CAST*/w; |
y += /*info:DYNAMIC_CAST*/w; |
z += /*info:DYNAMIC_CAST*/w; |
@@ -302,7 +302,7 @@ test() { |
a += b; |
a += /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/a; |
a -= b; |
- /*error:STATIC_TYPE_ERROR*/b -= /*error:INVALID_ASSIGNMENT*/b; |
+ b -= /*error:INVALID_ASSIGNMENT*/b; |
a <<= b; |
a >>= b; |
a &= b; |
@@ -373,6 +373,20 @@ main() { |
'''); |
} |
+ void test_compoundAssignment_returnsDynamic() { |
+ checkFile(r''' |
+class Foo { |
+ operator +(other) => null; |
+} |
+ |
+main() { |
+ var foo = new Foo(); |
+ foo = /*info:DYNAMIC_CAST*/foo + 1; |
+ /*info:DYNAMIC_CAST*/foo += 1; |
+} |
+ '''); |
+ } |
+ |
void test_constructorInvalid() { |
// Regression test for https://github.com/dart-lang/sdk/issues/26695 |
checkFile(''' |
@@ -3845,11 +3859,13 @@ class A { |
A operator -(int x) => null; |
A operator -() => null; |
} |
+class B extends A {} |
foo() => new A(); |
test() { |
A a = new A(); |
+ B b = new B(); |
var c = foo(); |
dynamic d; |
@@ -3871,6 +3887,11 @@ test() { |
a--; |
(/*info:DYNAMIC_INVOKE*/d++); |
(/*info:DYNAMIC_INVOKE*/d--); |
+ |
+ ++/*info:DOWN_CAST_IMPLICIT_ASSIGN*/b; |
+ --/*info:DOWN_CAST_IMPLICIT_ASSIGN*/b; |
+ /*info:DOWN_CAST_IMPLICIT_ASSIGN*/b++; |
+ /*info:DOWN_CAST_IMPLICIT_ASSIGN*/b--; |
Leaf
2016/09/22 22:30:17
Maybe test the case where we are assigning the res
Jennifer Messerly
2016/09/22 22:32:19
great idea! Adding.
|
}'''); |
} |