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

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

Issue 23133003: Fix ClassMirror.typeArguments handling for dynamic only type arguments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/generics_test.dart
diff --git a/tests/lib/mirrors/generics_test.dart b/tests/lib/mirrors/generics_test.dart
index dcb9093eb1e42e33d3a91dee2c6f8841d15a1807..e5e2c2ff179481d714f86b626c9d2d44c6f16915 100644
--- a/tests/lib/mirrors/generics_test.dart
+++ b/tests/lib/mirrors/generics_test.dart
@@ -15,6 +15,7 @@ class D extends A<int> {}
class E<S> extends A<S> {}
class F<R> extends A<int> {}
class G {}
+class H<A,B,C> {}
typeParameters(mirror, parameterNames) {
Expect.listEquals(parameterNames.map((n) => new Symbol(n)).toList(),
@@ -72,15 +73,25 @@ main() {
typeParameters(reflect(new E()).type, ['S']);
typeParameters(reflect(new F<num>()).type, ['R']);
typeParameters(reflect(new G()).type, []);
+ typeParameters(reflect(new H()).type, ['A', 'B', 'C']);
var numMirror = reflectClass(num);
+ var dynamicMirror = currentMirrorSystem().dynamicType;
typeArguments(reflect(new A<num>()).type, [numMirror]);
+ typeArguments(reflect(new A<dynamic>()).type, [dynamicMirror]);
+ typeArguments(reflect(new A()).type, [dynamicMirror]);
typeArguments(reflect(new B()).type, []);
typeArguments(reflect(new C()).type, []);
typeArguments(reflect(new D()).type, []);
typeArguments(reflect(new E<num>()).type, [numMirror]);
+ typeArguments(reflect(new E<dynamic>()).type, [dynamicMirror]);
+ typeArguments(reflect(new E()).type, [dynamicMirror]);
typeArguments(reflect(new F<num>()).type, [numMirror]);
+ typeArguments(reflect(new F<dynamic>()).type, [dynamicMirror]);
+ typeArguments(reflect(new F()).type, [dynamicMirror]);
typeArguments(reflect(new G()).type, []);
+ typeArguments(reflect(new H<dynamic, num, dynamic>()).type,
+ [dynamicMirror, numMirror, dynamicMirror]);
Expect.isFalse(reflect(new A<num>()).type.isOriginalDeclaration);
Expect.isTrue(reflect(new B()).type.isOriginalDeclaration);
@@ -89,6 +100,7 @@ main() {
Expect.isFalse(reflect(new E<num>()).type.isOriginalDeclaration);
Expect.isFalse(reflect(new F<num>()).type.isOriginalDeclaration);
Expect.isTrue(reflect(new G()).type.isOriginalDeclaration);
+ Expect.isFalse(reflect(new H()).type.isOriginalDeclaration);
Expect.equals(reflectClass(A),
reflect(new A<num>()).type.originalDeclaration);
@@ -104,6 +116,8 @@ main() {
reflect(new F<num>()).type.originalDeclaration);
Expect.equals(reflectClass(G),
reflect(new G()).type.originalDeclaration);
+ Expect.equals(reflectClass(H),
+ reflect(new H()).type.originalDeclaration);
Expect.notEquals(reflect(new A<num>()).type,
reflect(new A<num>()).type.originalDeclaration);
@@ -119,6 +133,8 @@ main() {
reflect(new F<num>()).type.originalDeclaration);
Expect.equals(reflect(new G()).type,
reflect(new G()).type.originalDeclaration);
+ Expect.notEquals(reflect(new H()).type,
+ reflect(new H()).type.originalDeclaration);
// Library members are all uninstantaited generics or non-generics.
currentMirrorSystem().libraries.values.forEach((libraryMirror) {
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698