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

Side by Side Diff: tests/language/throw_expr_test.dart

Issue 14756007: Fix issue 10487 by adapting the type checker so it uses the dynamic type for throw expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/typechecker.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 // Dart test program for testing throw expressions. 7 // Dart test program for testing throw expressions.
8 8
9 void test1() { 9 void test1() {
10 var x = 6; 10 var x = 6;
(...skipping 30 matching lines...) Expand all
41 Expect.equals(15, x); 41 Expect.equals(15, x);
42 } 42 }
43 43
44 foo(x, y) => throw "foo" "$x"; 44 foo(x, y) => throw "foo" "$x";
45 45
46 bar(x, y) => throw "foo" "${throw x}"; 46 bar(x, y) => throw "foo" "${throw x}";
47 47
48 class Q { 48 class Q {
49 var qqq; 49 var qqq;
50 f(x) { qqq = x; } 50 f(x) { qqq = x; }
51 Q get nono => throw "nono";
51 } 52 }
52 53
53 void test3() { 54 void test3() {
54 try { 55 try {
55 throw throw throw "up"; 56 throw throw throw "up";
56 } catch(e) { 57 } catch(e) {
57 Expect.equals("up", e); 58 Expect.equals("up", e);
58 } 59 }
59 60
60 var x = 10; 61 var x = 10;
(...skipping 23 matching lines...) Expand all
84 x = null; 85 x = null;
85 try { 86 try {
86 x = new Q(); 87 x = new Q();
87 x..f(11) ..qqq = throw 77 ..f(22); 88 x..f(11) ..qqq = throw 77 ..f(22);
88 } catch(e) { 89 } catch(e) {
89 Expect.equals(77, e); 90 Expect.equals(77, e);
90 Expect.equals(11, x.qqq); 91 Expect.equals(11, x.qqq);
91 } 92 }
92 } 93 }
93 94
95 void test4() {
96 var q = new Q();
97 Expect.throws(() => q.nono, (e) => e == "nono");
98 }
99
94 main() { 100 main() {
95 test1(); 101 test1();
96 test2(); 102 test2();
97 test3(); 103 test3();
104 test4();
98 } 105 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/typechecker.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698