Index: tests/compiler/dart2js_extra/first_class_types_hashcode_test.dart |
diff --git a/tests/compiler/dart2js_extra/first_class_types_hashcode_test.dart b/tests/compiler/dart2js_extra/first_class_types_hashcode_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2c5d989184caeadb0620322257221e2f90be2b40 |
--- /dev/null |
+++ b/tests/compiler/dart2js_extra/first_class_types_hashcode_test.dart |
@@ -0,0 +1,22 @@ |
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+// Check that Type instances work with maps. |
ngeoffray
2012/11/19 15:40:32
Please add the comment that it assumes canonicaliz
|
+ |
+class A {} |
+ |
+class B<T> {} |
+ |
+main() { |
+ Map<Type, String> map = new Map<Type, String>(); |
+ A a = new A().runtimeType; |
+ B b1 = new B<int>().runtimeType; |
+ B b2 = new B<String>().runtimeType; |
+ map[a] = 'A'; |
+ map[b1] = 'B<int>'; |
+ map[b2] = 'B<String>'; |
+ Expect.equals('A', map[new A().runtimeType]); |
+ Expect.equals('B<int>', map[new B<int>().runtimeType]); |
+ Expect.equals('B<String>', map[new B<String>().runtimeType]); |
+} |