| 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 |
| 10 class B extends A { | 11 class B extends A { |
| 11 var b = true; | 12 var b = true; |
| 12 } | 13 } |
| 14 |
| 13 class C extends B { | 15 class C extends B { |
| 14 var c = true; | 16 var c = true; |
| 15 } | 17 } |
| 18 |
| 16 class D extends A { | 19 class D extends A { |
| 17 var d = true; | 20 var d = true; |
| 18 } | 21 } |
| 22 |
| 19 class E implements C, D { | 23 class E implements C, D { |
| 20 var a = true; | 24 var a = true; |
| 21 var b = true; | 25 var b = true; |
| 22 var c = true; | 26 var c = true; |
| 23 var d = true; | 27 var d = true; |
| 24 } | 28 } |
| 25 | 29 |
| 26 void main() { | 30 void main() { |
| 27 A a = new E(); | 31 A a = new E(); |
| 28 var b; | 32 var b; |
| 29 if (a is D && ((a = new D()) != null)) { | 33 if (a is D && ((a = new D()) != null)) { |
| 30 b = a.d; //# 01: static type warning | 34 b = a.d; //# 01: static type warning |
| 31 } | 35 } |
| 32 if (a is D && (b = a.d)) { | 36 if (a is D && (b = a.d)) { |
| 33 b = a.d; //# 02: static type warning | 37 b = a.d; //# 02: static type warning |
| 34 a = null; | 38 a = null; |
| 35 } | 39 } |
| 36 if ((((a) is D) && (b = (a).d))) { | 40 if ((((a) is D) && (b = (a).d))) { |
| 37 b = a.d; //# 03: static type warning | 41 b = a.d; //# 03: static type warning |
| 38 a = null; | 42 a = null; |
| 39 } | 43 } |
| 40 if (f(a = null) && a is D) { | 44 if (f(a = null) && a is D) { |
| 41 b = a.d; | 45 b = a.d; |
| 42 } | 46 } |
| 43 } | 47 } |
| 44 | 48 |
| 45 bool f(x) => true; | 49 bool f(x) => true; |
| OLD | NEW |