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