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

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

Issue 689173004: Properly implement identical() test in analyzer constant evaluation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest.dart ('k') | tests/language/language_analyzer.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 const b = const {
22 identical_fg: 0, /// 03: static type warning
23 identical_gf: 0, /// 04: static type warning
24 false: 0 };
25
26 use(x) => x;
27
28 main() {
29 use(a);
30 use(b);
31
32 // Verify proper run time computation of identical()
33 Expect.isTrue(identical_ff); /// 05: ok
34 Expect.isTrue(identical_gg); /// 06: ok
35 Expect.isFalse(identical_fg); /// 07: ok
36 Expect.isFalse(identical_gf); /// 08: ok
37 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest.dart ('k') | tests/language/language_analyzer.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698