OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 import 'package:expect/expect.dart'; | |
6 | |
7 f() {} | |
8 const g = 1; | |
9 | |
10 const identical_ff = identical(f, f); | |
11 const identical_fg = identical(f, g); | |
12 const identical_gf = identical(g, f); | |
13 const identical_gg = identical(g, g); | |
14 | |
15 // Verify proper compile time computation of identical() | |
16 const a = const { | |
17 identical_ff: 0, //# 01: static type warning | |
18 identical_gg: 0, //# 02: static type warning | |
19 true: 0 | |
20 }; | |
21 | |
22 const b = const { | |
23 identical_fg: 0, //# 03: static type warning | |
24 identical_gf: 0, //# 04: static type warning | |
25 false: 0 | |
26 }; | |
27 | |
28 use(x) => x; | |
29 | |
30 main() { | |
31 use(a); | |
32 use(b); | |
33 | |
34 // Verify proper run time computation of identical() | |
35 Expect.isTrue(identical_ff); //# 05: ok | |
36 Expect.isTrue(identical_gg); //# 06: ok | |
37 Expect.isFalse(identical_fg); //# 07: ok | |
38 Expect.isFalse(identical_gf); //# 08: ok | |
39 } | |
OLD | NEW |