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

Unified Diff: tests/language/malformed_test.dart

Issue 21049012: Update VM to handle malformed types according to revised spec (issues 9055, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « tests/language/language_dart2js.status ('k') | tests/language/mixin_type_parameters_errors_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/malformed_test.dart
===================================================================
--- tests/language/malformed_test.dart (revision 25651)
+++ tests/language/malformed_test.dart (working copy)
@@ -6,6 +6,7 @@
// wrong number of type arguments are handled as raw types.
import 'package:expect/expect.dart';
+import 'package:expect/expect.dart' as prefix; // Define 'prefix'.
checkIsUnresolved(var v) {
Expect.isTrue(v is Unresolved);
@@ -76,8 +77,7 @@
checkIsListDynamic(true, []);
checkIsListDynamic(true, <>[]); /// 01: compile-time error
-// TODO(johnniwinther): Create runtime type information on literal lists.
-// checkIsListDynamic(false, <int>[]);
+ checkIsListDynamic(false, <int>[]);
checkIsListDynamic(true, <Unresolved>[]);
checkIsListDynamic(true, <Unresolved<int>>[]);
checkIsListDynamic(true, <prefix.Unresolved>[]);
@@ -92,16 +92,16 @@
checkIsListDynamic(true, new List<prefix.Unresolved<int>>());
checkIsListDynamic(true, new List<int, String>());
+ checkIsMapDynamic(true, true, <dynamic, dynamic>{});
checkIsMapDynamic(true, true, {});
checkIsMapDynamic(true, true, <>{}); /// 03: compile-time error
checkIsMapDynamic(true, true, <int>{});
-// TODO(johnniwinther): Create runtime type information on literal maps.
-// checkIsMapDynamic(false, false, <String, int>{});
+ checkIsMapDynamic(false, false, <String, int>{});
checkIsMapDynamic(true, true, <String, int, String>{});
-// checkIsMapDynamic(true, false, <Unresolved, int>{});
-// checkIsMapDynamic(false, true, <String, Unresolved<int>>{});
-// checkIsMapDynamic(true, false, <prefix.Unresolved, int>{});
-// checkIsMapDynamic(false, true, <String, prefix.Unresolved<int>>{});
+ checkIsMapDynamic(true, false, <Unresolved, int>{});
+ checkIsMapDynamic(false, true, <String, Unresolved<int>>{});
+ checkIsMapDynamic(true, false, <prefix.Unresolved, int>{});
+ checkIsMapDynamic(false, true, <String, prefix.Unresolved<int>>{});
checkIsMapDynamic(true, true, new Map());
checkIsMapDynamic(true, true, new Map<>); /// 04: compile-time error
@@ -118,28 +118,36 @@
Expect.throws(() => new prefix.Unresolved(), (e) => true);
Expect.throws(() => new prefix.Unresolved<int>(), (e) => true);
+ // The expression 'undeclared_prefix.Unresolved()' is parsed as the invocation
+ // of the named constructor 'Unresolved' on the type 'undeclared_prefix'.
+ Expect.throws(() => new undeclared_prefix.Unresolved(), (e) => true);
+ // The expression 'undeclared_prefix.Unresolved<int>' cannot be parsed.
+ Expect.throws(() => new undeclared_prefix.Unresolved<int>(), (e) => true); /// 05: compile-time error
+
try {
throw 'foo';
} on Unresolved catch (e) {
- } catch (e) {
- Expect.fail();
+ // Equivalent to 'on dynamic', catches 'foo'.
}
try {
throw 'foo';
} on Unresolved<int> catch (e) {
- } catch (e) {
- Expect.fail();
+ // Equivalent to 'on dynamic', catches 'foo'.
}
try {
throw 'foo';
} on prefix.Unresolved catch (e) {
- } catch (e) {
- Expect.fail();
+ // Equivalent to 'on dynamic', catches 'foo'.
}
try {
throw 'foo';
} on prefix.Unresolved<int> catch (e) {
- } catch (e) {
- Expect.fail();
+ // Equivalent to 'on dynamic', catches 'foo'.
}
+ try {
+ throw 'foo';
+ }
+ on undeclared_prefix.Unresolved<int> /// 06: compile-time error
+ catch (e) {
+ }
}
« no previous file with comments | « tests/language/language_dart2js.status ('k') | tests/language/mixin_type_parameters_errors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698