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

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

Issue 22902002: Ensure the classes void and dynamic have empty arrays for fields, functions, etc. Move their Types … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove redudant mirror asserts, fix test Created 7 years, 4 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 | « runtime/vm/snapshot.cc ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Dart test program testing the use of 'dynamic' in generic types. 5 // Dart test program testing the use of 'dynamic' in generic types.
6 // @static-clean 6 // @static-clean
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 9
10 abstract class Iface<K,V> { 10 abstract class Iface<K,V> {
(...skipping 13 matching lines...) Expand all
24 class HasFieldDynamic { 24 class HasFieldDynamic {
25 HasFieldDynamic() : dynamic = "dynamic" { } 25 HasFieldDynamic() : dynamic = "dynamic" { }
26 var dynamic; // Field named dynamic is allowed. 26 var dynamic; // Field named dynamic is allowed.
27 } 27 }
28 28
29 class HasMethodDynamic { 29 class HasMethodDynamic {
30 dynamic() => "dynamic"; // Method named dynamic is allowed. 30 dynamic() => "dynamic"; // Method named dynamic is allowed.
31 } 31 }
32 32
33 main() { 33 main() {
34 Expect.isTrue(dynamic is Type);
35 Expect.equals(dynamic, dynamic);
36
34 M1<dynamic, dynamic> m1 = new M1<dynamic, dynamic>(); 37 M1<dynamic, dynamic> m1 = new M1<dynamic, dynamic>();
35 Expect.isTrue(m1 is Iface<dynamic, num>); 38 Expect.isTrue(m1 is Iface<dynamic, num>);
36 Expect.isTrue(m1 is Iface<String, dynamic>); 39 Expect.isTrue(m1 is Iface<String, dynamic>);
37 Expect.isTrue(m1 is Iface<String, num>); 40 Expect.isTrue(m1 is Iface<String, num>);
38 Expect.isTrue(m1 is Iface<num, String>); 41 Expect.isTrue(m1 is Iface<num, String>);
39 42
40 M2<dynamic> m2 = new M2<dynamic>(); 43 M2<dynamic> m2 = new M2<dynamic>();
41 Expect.isTrue(m2 is Iface<dynamic, num>); 44 Expect.isTrue(m2 is Iface<dynamic, num>);
42 Expect.isTrue(m2 is Iface<String, dynamic>); 45 Expect.isTrue(m2 is Iface<String, dynamic>);
43 Expect.isTrue(m2 is Iface<String, num>); 46 Expect.isTrue(m2 is Iface<String, num>);
(...skipping 12 matching lines...) Expand all
56 Expect.equals("dynamic", has_field.dynamic); 59 Expect.equals("dynamic", has_field.dynamic);
57 60
58 HasMethodDynamic has_method = new HasMethodDynamic(); 61 HasMethodDynamic has_method = new HasMethodDynamic();
59 Expect.equals("dynamic", has_method.dynamic()); 62 Expect.equals("dynamic", has_method.dynamic());
60 63
61 { 64 {
62 int dynamic = 0; // Local variable named dynamic is allowed. 65 int dynamic = 0; // Local variable named dynamic is allowed.
63 Expect.equals(0, dynamic); 66 Expect.equals(0, dynamic);
64 } 67 }
65 } 68 }
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698