OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // VMOptions=--enable_type_checks | 4 // VMOptions=--enable_type_checks |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 main() { | 8 main() { |
9 var a; | 9 var a; |
10 Expect.throws(() { true && (a = 5); }, (error) => error is TypeError); | 10 Expect.throws(() { |
11 Expect.throws(() { (a = 5) && true; }, (error) => error is TypeError); | 11 true && (a = 5); |
12 Expect.throws(() { false || (a = 5); }, (error) => error is TypeError); | 12 }, (error) => error is TypeError); |
13 Expect.throws(() { (a = 5) || false; }, (error) => error is TypeError); | 13 Expect.throws(() { |
14 Expect.throws(() { (a = 5) || true; }, (error) => error is TypeError); | 14 (a = 5) && true; |
| 15 }, (error) => error is TypeError); |
| 16 Expect.throws(() { |
| 17 false || (a = 5); |
| 18 }, (error) => error is TypeError); |
| 19 Expect.throws(() { |
| 20 (a = 5) || false; |
| 21 }, (error) => error is TypeError); |
| 22 Expect.throws(() { |
| 23 (a = 5) || true; |
| 24 }, (error) => error is TypeError); |
15 | 25 |
16 // No exceptions thrown. | 26 // No exceptions thrown. |
17 false && (a = 5); | 27 false && (a = 5); |
18 true || (a = 5); | 28 true || (a = 5); |
19 } | 29 } |
20 | |
OLD | NEW |