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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 // Regression test for dart2js where the reference to [:this:] in a | 7 // Regression test for dart2js where the reference to [:this:] in a |
8 // constructor was not propagated to the super initializers. | 8 // constructor was not propagated to the super initializers. |
9 | 9 |
10 class A<T> { | 10 class A<T> { |
11 var map; | 11 var map; |
12 // Usage of type variables in the initializer makes the SSA builder | 12 // Usage of type variables in the initializer makes the SSA builder |
13 // want to access [:this:]. And because the initializers of A are | 13 // want to access [:this:]. And because the initializers of A are |
14 // inlined in the constructor of B, we have to make sure the | 14 // inlined in the constructor of B, we have to make sure the |
15 // [:this:] in the A constructor has a corresponding | 15 // [:this:] in the A constructor has a corresponding |
16 // SSA instruction. | 16 // SSA instruction. |
17 A() : map = new Map<T, T>(); | 17 A() : map = new Map<T, T>(); |
18 } | 18 } |
19 | 19 |
20 class B<T> extends A<T> {} | 20 class B<T> extends A<T> {} |
21 | 21 |
22 main() { | 22 main() { |
23 Expect.isTrue(new B<int>().map is Map<int, int>); | 23 Expect.isTrue(new B<int>().map is Map<int, int>); |
24 } | 24 } |
OLD | NEW |