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

Unified Diff: tests/language/wrong_number_type_arguments_test.dart

Issue 11412245: MalformedType used for all invalid type annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 8 years 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/language/wrong_number_type_arguments_test.dart
diff --git a/tests/language/wrong_number_type_arguments_test.dart b/tests/language/wrong_number_type_arguments_test.dart
index efb209962d78467cb4711b76fd6f9aa6aa10ff23..f04f438524b2fd63b7c79b7930c7572133c13c2b 100644
--- a/tests/language/wrong_number_type_arguments_test.dart
+++ b/tests/language/wrong_number_type_arguments_test.dart
@@ -3,9 +3,39 @@
// BSD-style license that can be found in the LICENSE file.
// Map takes 2 type arguments.
-Map<String> foo; /// 00: static type warning
+Map
+<String> /// 00: static type warning
+foo;
+Map
+<String> /// 02: static type warning
+baz;
main() {
- foo = null; /// 00: continued
- var bar = new Map<String>(); /// 01: compile-time error
+ foo = null;
+ var bar = new Map
+ <String> /// 01: compile-time error
+ ();
+ testNonNullAssignment(); /// 02: continued
+}
+
+isCheckedMode() {
+ try {
+ var i = 1;
+ String s = i;
+ return false;
+ } catch (e) {
+ return true;
+ }
+}
+
+void testNonNullAssignment() {
+ bool got_type_error = false;
+ try {
+ baz = new Map();
+ } on TypeError catch (error) {
+ print(error);
+ got_type_error = true;
+ }
+ // Type error in checked mode only.
+ Expect.isTrue(got_type_error == isCheckedMode());
}

Powered by Google App Engine
This is Rietveld 408576698