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 | 4 |
5 // Test type promotion of locals potentially mutated. | 5 // Test type promotion of locals potentially mutated. |
6 | 6 |
7 class A { | 7 class A { |
8 var a = true; | 8 var a = true; |
9 } | 9 } |
10 class B extends A { | 10 class B extends A { |
(...skipping 15 matching lines...) Expand all Loading... |
26 void main() { | 26 void main() { |
27 A a = new E(); | 27 A a = new E(); |
28 var b; | 28 var b; |
29 if (a is D && ((a = new D()) != null)) { | 29 if (a is D && ((a = new D()) != null)) { |
30 b = a.d; /// 01: static type warning | 30 b = a.d; /// 01: static type warning |
31 } | 31 } |
32 if (a is D && (b = a.d)) { | 32 if (a is D && (b = a.d)) { |
33 b = a.d; /// 02: static type warning | 33 b = a.d; /// 02: static type warning |
34 a = null; | 34 a = null; |
35 } | 35 } |
| 36 if ((((a) is D) && (b = (a).d))) { |
| 37 b = a.d; /// 03: static type warning |
| 38 a = null; |
| 39 } |
36 if (f(a = null) && a is D) { | 40 if (f(a = null) && a is D) { |
37 b = a.d; | 41 b = a.d; |
38 } | 42 } |
39 } | 43 } |
40 | 44 |
41 bool f(x) => true; | 45 bool f(x) => true; |
OLD | NEW |