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

Unified Diff: tests/lib/mirrors/type_mirror_for_type_test.dart

Issue 556833004: Check against the correct type when decoding runtime types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comparison of result. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/js_mirrors.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/type_mirror_for_type_test.dart
diff --git a/tests/lib/mirrors/type_mirror_for_type_test.dart b/tests/lib/mirrors/type_mirror_for_type_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..3c3d53a3f16bf77382deb8772829bda8f9037bdc
--- /dev/null
+++ b/tests/lib/mirrors/type_mirror_for_type_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2014, 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.
+
+// Regression test for the dart2js implementation of runtime types.
+
+library test.type_mirror_for_type;
+
+import 'package:expect/expect.dart';
+
+@MirrorsUsed(targets: 'test.type_mirror_for_type')
+import 'dart:mirrors';
+
+class C<T> {}
+
+class X {
+ Type foo() {}
+}
+
+main() {
+ // Make sure that we need a type test against the runtime representation of
+ // [Type].
+ var a = (new DateTime.now().millisecondsSinceEpoch != 42)
+ ? new C<Type>() : new C<int>();
+ print (a is C<Type>);
+
+ var typeMirror = reflectType(X);
+ var declarationMirror = typeMirror.declarations[#foo];
+ // Test that the runtime type implementation does not confuse the runtime type
+ // representation of [Type] with an actual value of type [Type] when analyzing
+ // the return type of [foo].
+ Expect.equals(reflectType(Type), declarationMirror.returnType);
+}
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/js_mirrors.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698