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

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

Issue 15689009: Type check try statements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename variable. Created 7 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
« no previous file with comments | « tests/compiler/dart2js/size_test.dart ('k') | tests/compiler/dart2js/value_range_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/type_checker_test.dart
diff --git a/tests/compiler/dart2js/type_checker_test.dart b/tests/compiler/dart2js/type_checker_test.dart
index 6b813b0616bbb844aa276284452147ab5e7a04c7..0dcfd071aa008d701c2ee3425e65391f30157a90 100644
--- a/tests/compiler/dart2js/type_checker_test.dart
+++ b/tests/compiler/dart2js/type_checker_test.dart
@@ -31,6 +31,7 @@ main() {
testReturn,
testFor,
testWhile,
+ testTry,
testOperators,
testConstructorInvocationArgumentCount,
testConstructorInvocationArgumentTypes,
@@ -107,6 +108,21 @@ testWhile() {
analyze("do { int i = 0.5; } while (null);", MessageKind.NOT_ASSIGNABLE);
}
+testTry() {
+ analyze("try {} finally {}");
+ analyze("try {} catch (e) { int i = e;} finally {}");
+ analyze("try {} catch (e, s) { int i = e; StackTrace j = s; } finally {}");
+ analyze("try {} on String catch (e) {} finally {}");
+ analyze("try { int i = ''; } finally {}", MessageKind.NOT_ASSIGNABLE);
+ analyze("try {} finally { int i = ''; }", MessageKind.NOT_ASSIGNABLE);
+ analyze("try {} on String catch (e) { int i = e; } finally {}",
+ MessageKind.NOT_ASSIGNABLE);
+ analyze("try {} catch (e, s) { int i = e; int j = s; } finally {}",
+ MessageKind.NOT_ASSIGNABLE);
+ analyze("try {} on String catch (e, s) { int i = e; int j = s; } finally {}",
+ [MessageKind.NOT_ASSIGNABLE, MessageKind.NOT_ASSIGNABLE]);
+}
+
testOperators() {
// TODO(karlklose): add the DartC tests for operators when we can parse
// classes with operators.
« no previous file with comments | « tests/compiler/dart2js/size_test.dart ('k') | tests/compiler/dart2js/value_range_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698