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 bug http://dartbug.com/11570. | 5 // Regression test for dart2js bug http://dartbug.com/11570. |
6 | 6 |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 | 8 |
9 void main() { | 9 void main() { |
10 var c = new Cool(true); | 10 var c = new Cool(true); |
11 Expect.stringEquals('{}', '${c.thing}'); | 11 Expect.stringEquals('{}', '${c.thing}'); |
12 | 12 |
13 c = new Cool(false); | 13 c = new Cool(false); |
14 Expect.stringEquals('[]', '${c.thing}'); | 14 Expect.stringEquals('[]', '${c.thing}'); |
15 | 15 |
16 c = new Cool.alt(true); | 16 c = new Cool.alt(true); |
17 Expect.stringEquals('{}', '${c.thing}'); | 17 Expect.stringEquals('{}', '${c.thing}'); |
18 | 18 |
19 c = new Cool.alt(false); | 19 c = new Cool.alt(false); |
20 Expect.stringEquals('[]', '${c.thing}'); | 20 Expect.stringEquals('[]', '${c.thing}'); |
21 } | 21 } |
22 | 22 |
23 class Cool { | 23 class Cool { |
24 final thing; | 24 final thing; |
25 | 25 |
26 Cool(bool option) : thing = option ? <String, String>{} : <String>[]; | 26 Cool(bool option) : thing = option ? <String, String>{} : <String>[]; |
27 Cool.alt(bool option) : thing = !option ? <String>[] : <String, String>{}; | 27 Cool.alt(bool option) : thing = !option ? <String>[] : <String, String>{}; |
28 } | 28 } |
OLD | NEW |