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

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

Issue 22909056: Support general expressions as keys in literal maps. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/map_literal7_test.dart ('k') | tests/language/map_literal9_test.dart » ('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) 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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test the use of type arguments on const map literals using general expression
6 // as keys.
7
8 library map_literal8_test;
9
10 import "package:expect/expect.dart";
11
12 class A {
13 const A();
14 }
15 class B extends A {
16 final a;
17 const B(this.a);
18 }
19
20 void main() {
21 var m1 = const {
22 const A(): 0,
23 const B(0): 1,
24 const B(1): 2,
25 const B(const A()): 3,
26 const B(0): 4,
27 };
28 Expect.isTrue(m1 is Map);
29 Expect.isTrue(m1 is Map<A,int>);
30 Expect.isTrue(m1 is Map<int, dynamic>);
31 Expect.isTrue(m1 is Map<dynamic, A>);
32
33 var m2 = const <A, int>{
34 const A(): 0,
35 const B(0): 1,
36 const B(1): 2,
37 const B(const A()): 3,
38 const B(0): 4,
39 };
40 Expect.isTrue(m2 is Map);
41 Expect.isTrue(m2 is Map<A, int>);
42 Expect.isFalse(m2 is Map<int, dynamic>);
43 Expect.isFalse(m2 is Map<dynamic, A>);
44 }
OLDNEW
« no previous file with comments | « tests/language/map_literal7_test.dart ('k') | tests/language/map_literal9_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698