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

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

Issue 1089463003: Do not use erroneouselement unless the member is static (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/resolver_test.dart
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index 5f3a47215758034c85154d294eafbc5416ae0303..17339eb23ddd796331057612e243b55034a9ee7b 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -1145,15 +1145,13 @@ testConstConstructorAndNonFinalFields() {
}
testCantAssignMethods() {
- checkWarningOn(String script, List<String> errorLocations) {
+ checkWarningOn(String script, List<MessageKind> warnings) {
+ Expect.isTrue(warnings.length >= 0 && warnings.length <= 2);
asyncTest(() => compileScript(script).then((compiler) {
Expect.equals(0, compiler.errors.length);
- Expect.equals(errorLocations.length, compiler.warnings.length);
- for (var i = 0; i < errorLocations.length; i++) {
- Expect.equals(MessageKind.ASSIGNING_METHOD,
- compiler.warnings[i].message.kind);
- Expect.equals(script.indexOf(errorLocations[i]),
- compiler.warnings[i].node.getBeginToken().charOffset);
+ Expect.equals(warnings.length, compiler.warnings.length);
+ for (int i = 0; i < warnings.length; i++) {
+ Expect.equals(warnings[i], compiler.warnings[i].message.kind);
}
}));
}
@@ -1164,20 +1162,20 @@ testCantAssignMethods() {
mname() { mname = 2; };
mname();
}
- ''', ['mname = 2']);
+ ''', [MessageKind.ASSIGNING_METHOD]);
checkWarningOn('''
main() {
mname() { };
mname = 3;
}
- ''', ['mname = 3']);
+ ''', [MessageKind.ASSIGNING_METHOD]);
// Can't override top-level functions
checkWarningOn('''
m() {}
main() { m = 4; }
- ''', ['m = 4']);
+ ''', [MessageKind.ASSIGNING_METHOD]);
// Can't override instance methods
checkWarningOn('''
@@ -1188,7 +1186,7 @@ testCantAssignMethods() {
mname = () => null;
}
}
- ''', ['mname = () => null']);
+ ''', [MessageKind.ASSIGNING_METHOD, MessageKind.SETTER_NOT_FOUND]);
Siggi Cherem (dart-lang) 2015/04/15 01:38:04 I'm not happy with the second error (which is curr
Johnni Winther 2015/04/15 08:58:03 Actually should not resolve [target] to an instanc
Siggi Cherem (dart-lang) 2015/04/15 22:39:46 Good point - I changed it so that the checker repo
// Can't override super methods
checkWarningOn('''
@@ -1201,7 +1199,7 @@ testCantAssignMethods() {
super.mname = () => 6;
}
}
- ''', ['mname = () => 6']);
+ ''', [MessageKind.ASSIGNING_METHOD, MessageKind.SETTER_NOT_FOUND]);
// But fields are OK:
checkWarningOn('''
« pkg/compiler/lib/src/resolution/members.dart ('K') | « tests/co19/co19-dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698