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

Unified Diff: tests/compiler/dart2js/semantic_visitor_test_send_data.dart

Issue 1262363003: Handle super index SendSet operations. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 5 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: tests/compiler/dart2js/semantic_visitor_test_send_data.dart
diff --git a/tests/compiler/dart2js/semantic_visitor_test_send_data.dart b/tests/compiler/dart2js/semantic_visitor_test_send_data.dart
index dfcfda9319d756df7e2a76c45171320d51eabd8d..d1fa0725b8410cc2d01f5e78fff71549d7d68531 100644
--- a/tests/compiler/dart2js/semantic_visitor_test_send_data.dart
+++ b/tests/compiler/dart2js/semantic_visitor_test_send_data.dart
@@ -1730,6 +1730,19 @@ const Map<String, List<Test>> SEND_TESTS = const {
''',
const Visit(VisitKind.ERROR_UNDEFINED_BINARY_EXPRESSION,
left: '2', operator: '!==', right: '3')),
+ const Test.clazz(
+ '''
+ class B {
+ operator +(_) => null;
+ }
+ class C extends B {
+ static m() => super + 42;
+ }
+ ''',
+ const Visit(VisitKind.ERROR_INVALID_BINARY,
+ error: MessageKind.NO_SUPER_IN_STATIC,
+ operator: '+',
+ right: '42')),
],
'Index': const [
// Index
@@ -1777,6 +1790,18 @@ const Map<String, List<Test>> SEND_TESTS = const {
'''
class B {
operator [](_) => null;
+ }
+ class C extends B {
+ static m() => super[42];
+ }
+ ''',
+ const Visit(VisitKind.ERROR_INVALID_INDEX,
+ error: MessageKind.NO_SUPER_IN_STATIC,
+ index: '42')),
+ const Test.clazz(
+ '''
+ class B {
+ operator [](_) => null;
operator []=(a, b) {}
}
class C extends B {
@@ -1832,6 +1857,20 @@ const Map<String, List<Test>> SEND_TESTS = const {
operator []=(a, b) {}
}
class C extends B {
+ static m() => ++super[42];
+ }
+ ''',
+ const Visit(VisitKind.ERROR_INVALID_INDEX_PREFIX,
+ error: MessageKind.NO_SUPER_IN_STATIC,
+ index: '42',
+ operator: '++')),
+ const Test.clazz(
+ '''
+ class B {
+ operator [](_) => null;
+ operator []=(a, b) {}
+ }
+ class C extends B {
m() => super[42]--;
}
''',
@@ -1877,6 +1916,20 @@ const Map<String, List<Test>> SEND_TESTS = const {
getter: 'function(B#[])',
index: '42',
operator: '--')),
+ const Test.clazz(
+ '''
+ class B {
+ operator [](_) => null;
+ operator []=(a, b) {}
+ }
+ class C extends B {
+ static m() => super[42]--;
+ }
+ ''',
+ const Visit(VisitKind.ERROR_INVALID_INDEX_POSTFIX,
+ error: MessageKind.NO_SUPER_IN_STATIC,
+ index: '42',
+ operator: '--')),
],
'Equals': const [
// Equals
@@ -1898,6 +1951,18 @@ const Map<String, List<Test>> SEND_TESTS = const {
const Visit(VisitKind.VISIT_SUPER_EQUALS,
element: 'function(B#==)',
right: '42')),
+ const Test.clazz(
+ '''
+ class B {
+ operator ==(_) => null;
+ }
+ class C extends B {
+ static m() => super == 42;
+ }
+ ''',
+ const Visit(VisitKind.ERROR_INVALID_EQUALS,
+ error: MessageKind.NO_SUPER_IN_STATIC,
+ right: '42')),
],
'Not equals': const [
// Not equals
@@ -1919,6 +1984,18 @@ const Map<String, List<Test>> SEND_TESTS = const {
const Visit(VisitKind.VISIT_SUPER_NOT_EQUALS,
element: 'function(B#==)',
right: '42')),
+ const Test.clazz(
+ '''
+ class B {
+ operator ==(_) => null;
+ }
+ class C extends B {
+ static m() => super != 42;
+ }
+ ''',
+ const Visit(VisitKind.ERROR_INVALID_NOT_EQUALS,
+ error: MessageKind.NO_SUPER_IN_STATIC,
+ right: '42')),
],
'Unary expression': const [
// Unary expression
@@ -1966,6 +2043,18 @@ const Map<String, List<Test>> SEND_TESTS = const {
''',
const Visit(VisitKind.VISIT_SUPER_UNARY,
element: 'function(B#~)', operator: '~')),
+ const Test.clazz(
+ '''
+ class B {
+ operator -() => null;
+ }
+ class C extends B {
+ static m() => -super;
+ }
+ ''',
+ const Visit(VisitKind.ERROR_INVALID_UNARY,
+ error: MessageKind.NO_SUPER_IN_STATIC,
+ operator: '-')),
const Test(
'''
m() => !0;
@@ -2009,6 +2098,17 @@ const Map<String, List<Test>> SEND_TESTS = const {
''',
const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_SET,
index: '1', rhs: '2')),
+ const Test.clazz(
+ '''
+ class B {
+ operator []=(a, b) {}
+ }
+ class C extends B {
+ static m() => super[1] = 2;
+ }
+ ''',
+ const Visit(VisitKind.ERROR_INVALID_INDEX_SET,
+ error: MessageKind.NO_SUPER_IN_STATIC, index: '1', rhs: '2')),
],
'Compound assignment': const [
// Compound assignment
@@ -2511,6 +2611,19 @@ const Map<String, List<Test>> SEND_TESTS = const {
const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND_INDEX_SET,
getter: 'function(B#[])',
index: '1', operator: '+=', rhs: '42')),
+ const Test.clazz(
+ '''
+ class B {
+ operator [](_) {}
+ operator []=(a, b) {}
+ }
+ class C extends B {
+ static m() => super[1] += 42;
+ }
+ ''',
+ const Visit(VisitKind.ERROR_INVALID_COMPOUND_INDEX_SET,
+ error: MessageKind.NO_SUPER_IN_STATIC,
+ index: '1', operator: '+=', rhs: '42')),
],
'Prefix expression': const [
// Prefix expression
« no previous file with comments | « tests/compiler/dart2js/semantic_visitor_test.dart ('k') | tests/compiler/dart2js/semantic_visitor_test_send_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698