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

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

Issue 10908142: Add runtimeType() to Object which returns canonicalized instances of Type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address more comments. Created 8 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 class C<T> {}
6
7 sameType(a, b) {
8 Expect.isTrue(a.runtimeType() === b.runtimeType());
9 }
10
11 differentType(a, b) {
12 Expect.isFalse(a.runtimeType() === b.runtimeType());
13 }
14
15 main() {
16 var v1 = new C<int>();
17 var v2 = new C<int>();
18 sameType(v1, v2);
19
20 var v3 = new C<num>();
21 differentType(v1, v3);
22
23 var i = 1;
24 var s = 'string';
25 var d = 3.14;
26 sameType(2, i);
27 sameType('hest', s);
28 sameType(1.2, d);
29
30 var l = [1, 2, 3];
31 var m = {'a': 1, 'b': 2};
32 sameType([], l);
33 sameType({}, m);
34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698