Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: tests/language_2/identical_const_test.dart

Issue 3003933002: Migrate block 116. (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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 f() {} 7 f() {}
8 const g = 1; 8 const g = 1;
9 9
10 const identical_ff = identical(f, f); 10 const identical_ff = identical(f, f);
11 const identical_fg = identical(f, g); 11 const identical_fg = identical(f, g);
12 const identical_gf = identical(g, f); 12 const identical_gf = identical(g, f);
13 const identical_gg = identical(g, g); 13 const identical_gg = identical(g, g);
14 14
15 // Verify proper compile time computation of identical() 15 // Verify proper compile time computation of identical()
16 const a = const { 16 const a = const {
17 identical_ff: 0, //# 01: static type warning 17 identical_ff: 0, //# 01: compile-time error
18 identical_gg: 0, //# 02: static type warning 18 identical_gg: 0, //# 02: compile-time error
19 true: 0 19 true: 0
20 }; 20 };
21 21
22 const b = const { 22 const b = const {
23 identical_fg: 0, //# 03: static type warning 23 identical_fg: 0, //# 03: compile-time error
24 identical_gf: 0, //# 04: static type warning 24 identical_gf: 0, //# 04: compile-time error
25 false: 0 25 false: 0
26 }; 26 };
27 27
28 use(x) => x; 28 use(x) => x;
29 29
30 main() { 30 main() {
31 use(a); 31 use(a);
32 use(b); 32 use(b);
33 33
34 // Verify proper run time computation of identical() 34 // Verify proper run time computation of identical()
35 Expect.isTrue(identical_ff); //# 05: ok 35 Expect.isTrue(identical_ff); //# 05: ok
36 Expect.isTrue(identical_gg); //# 06: ok 36 Expect.isTrue(identical_gg); //# 06: ok
37 Expect.isFalse(identical_fg); //# 07: ok 37 Expect.isFalse(identical_fg); //# 07: ok
38 Expect.isFalse(identical_gf); //# 08: ok 38 Expect.isFalse(identical_gf); //# 08: ok
39 } 39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698