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

Unified Diff: test/checker/checker_test.dart

Issue 1160673003: fixes #202, check IndexExpression (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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: test/checker/checker_test.dart
diff --git a/test/checker/checker_test.dart b/test/checker/checker_test.dart
index fd5f8c023e142026637e620577fe3c0a34f95698..cf38d8f617e69eca3f493724cb7c54865aee9338 100644
--- a/test/checker/checker_test.dart
+++ b/test/checker/checker_test.dart
@@ -1923,7 +1923,7 @@ void main() {
}, inferFromOverrides: true);
});
- test('binary operators', () {
+ test('binary and index operators', () {
testChecker({
'/main.dart': '''
class A {
@@ -1938,6 +1938,7 @@ void main() {
A operator &(B b) {}
A operator ^(B b) {}
A operator |(B b) {}
+ A operator[](B b) {}
}
class B {
@@ -1979,6 +1980,11 @@ void main() {
p = (/*info:DynamicCast*/c) && /*info:DynamicCast*/c;
p = (/*severe:StaticTypeError*/y) && p;
p = c == y;
+
+ a = a[b];
+ a = a[/*info:DynamicCast*/c];
+ c = (/*info:DynamicInvoke*/c[b]);
+ a[/*severe:StaticTypeError*/y];
}
'''
});
@@ -1999,12 +2005,18 @@ void main() {
A operator &(B b) {}
A operator ^(B b) {}
A operator |(B b) {}
+ D operator [](B index) {}
+ void operator []=(B index, D value) {}
}
class B {
A operator -(B b) {}
}
+ class D {
+ D operator +(D d) {}
+ }
+
foo() => new A();
test() {
@@ -2049,6 +2061,14 @@ void main() {
a ^= b;
a |= b;
(/*info:DynamicInvoke*/c += b);
+
+ var d = new D();
+ a[b] += d;
+ a[/*info:DynamicCast*/c] += d;
+ a[/*severe:StaticTypeError*/z] += d;
+ a[b] += /*info:DynamicCast*/c;
+ a[b] += /*severe:StaticTypeError*/z;
+ (/*info:DynamicInvoke*/(/*info:DynamicInvoke*/c[b]) += d);
}
'''
});

Powered by Google App Engine
This is Rietveld 408576698