| 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 // Regression test for dart2js that used to optimistically infer the | 5 // Regression test for dart2js that used to optimistically infer the |
| 6 // wrong types for fields because of generative constructors being | 6 // wrong types for fields because of generative constructors being |
| 7 // inlined. | 7 // inlined. |
| 8 | 8 |
| 9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
| 10 import "compiler_annotations.dart"; | 10 import "compiler_annotations.dart"; |
| 11 | 11 |
| 12 class A { | 12 class A { |
| 13 var field; | 13 var field; |
| 14 A(this.field); | 14 A(this.field); |
| 15 } | 15 } |
| 16 | 16 |
| 17 var c = () => new List(42)[0]; | 17 dynamic c = () => new List(42)[0]; |
| 18 | 18 |
| 19 main() { | 19 main() { |
| 20 bar(); | 20 bar(); |
| 21 // Defeat type inferencing. | 21 // Defeat type inferencing. |
| 22 new A(c()); | 22 new A(c()); |
| 23 doIt(); | 23 doIt(); |
| 24 bar(); | 24 bar(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 @DontInline() | 27 @DontInline() |
| (...skipping 17 matching lines...) Expand all Loading... |
| 45 return inlineLevel3(); | 45 return inlineLevel3(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 inlineLevel3() { | 48 inlineLevel3() { |
| 49 return inlineLevel4(); | 49 return inlineLevel4(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 inlineLevel4() { | 52 inlineLevel4() { |
| 53 return new A(42); | 53 return new A(42); |
| 54 } | 54 } |
| OLD | NEW |