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

Side by Side Diff: tests/lib/mirrors/generic_mixin_applications_test.dart

Issue 3001373002: Migrated test block 220 to Dart 2.0. (Closed)
Patch Set: Created 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2013, 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 library test.generic_mixin_applications;
6
7 @MirrorsUsed(targets: "test.generic_mixin_applications")
8 import 'dart:mirrors';
9
10 import 'package:expect/expect.dart';
11
12 import 'generics_helper.dart';
13
14 class Super<S> {}
15
16 class Mixin<M> {}
17
18 class Nixim<N> {}
19
20 class NonGenericMixinApplication1 = Super with Mixin;
21 class NonGenericMixinApplication2 = Super<num> with Mixin<String>;
22
23 class GenericMixinApplication1<MA> = Super<MA> with Mixin<MA>;
24 class GenericMixinApplication2<MA> = Super<num> with Mixin<String>;
25
26 class NonGenericClass1 extends Super with Mixin {}
27
28 class NonGenericClass2 extends Super<num> with Mixin<String> {}
29
30 class GenericClass1<C> extends Super<C> with Mixin<C> {}
31
32 class GenericClass2<C> extends Super<num> with Mixin<String> {}
33
34 class GenericMultipleMixins<A, B, C> extends Super<A> with Mixin<B>, Nixim<C> {}
35
36 main() {
37 TypeMirror dynamicMirror = currentMirrorSystem().dynamicType;
38
39 // Declarations.
40 typeParameters(reflectClass(NonGenericMixinApplication1), []);
41 typeParameters(reflectClass(NonGenericMixinApplication2), []);
42 typeParameters(reflectClass(GenericMixinApplication1), [#MA]);
43 typeParameters(reflectClass(GenericMixinApplication2), [#MA]);
44 typeParameters(reflectClass(NonGenericClass1), []);
45 typeParameters(reflectClass(NonGenericClass2), []);
46 typeParameters(reflectClass(GenericClass1), [#C]);
47 typeParameters(reflectClass(GenericClass2), [#C]);
48 typeParameters(reflectClass(GenericMultipleMixins), [#A, #B, #C]);
49 // Anonymous mixin applications have no type parameters or type arguments.
50 typeParameters(reflectClass(NonGenericClass1).superclass, []);
51 typeParameters(reflectClass(NonGenericClass2).superclass, []);
52 typeParameters(reflectClass(GenericClass1).superclass, []);
53 typeParameters(reflectClass(GenericClass2).superclass, []);
54
55 typeArguments(reflectClass(NonGenericMixinApplication1), []);
56 typeArguments(reflectClass(NonGenericMixinApplication2), []);
57 typeArguments(reflectClass(GenericMixinApplication1), []);
58 typeArguments(reflectClass(GenericMixinApplication2), []);
59 typeArguments(reflectClass(NonGenericClass1), []);
60 typeArguments(reflectClass(NonGenericClass2), []);
61 typeArguments(reflectClass(GenericClass1), []);
62 typeArguments(reflectClass(GenericClass2), []);
63 typeArguments(reflectClass(GenericMultipleMixins), []);
64 // Anonymous mixin applications have no type parameters or type arguments.
65 typeArguments(
66 reflectClass(NonGenericClass1).superclass.originalDeclaration, []);
67 typeArguments(
68 reflectClass(NonGenericClass2).superclass.originalDeclaration, []);
69 typeArguments(reflectClass(GenericClass1).superclass.originalDeclaration, []);
70 typeArguments(reflectClass(GenericClass2).superclass.originalDeclaration, []);
71
72 // Instantiations.
73 typeParameters(reflect(new NonGenericMixinApplication1()).type, []);
74 typeParameters(reflect(new NonGenericMixinApplication2()).type, []);
75 typeParameters(reflect(new GenericMixinApplication1<bool>()).type, [#MA]);
76 typeParameters(reflect(new GenericMixinApplication2<bool>()).type, [#MA]);
77 typeParameters(reflect(new NonGenericClass1()).type, []);
78 typeParameters(reflect(new NonGenericClass2()).type, []);
79 typeParameters(reflect(new GenericClass1<bool>()).type, [#C]);
80 typeParameters(reflect(new GenericClass2<bool>()).type, [#C]);
81 typeParameters(reflect(new GenericMultipleMixins<bool, String, int>()).type,
82 [#A, #B, #C]);
83 // Anonymous mixin applications have no type parameters or type arguments.
84 typeParameters(reflect(new NonGenericClass1()).type.superclass, []);
85 typeParameters(reflect(new NonGenericClass2()).type.superclass, []);
86 typeParameters(reflect(new GenericClass1<bool>()).type.superclass, []);
87 typeParameters(reflect(new GenericClass2<bool>()).type.superclass, []);
88
89 typeArguments(reflect(new NonGenericMixinApplication1()).type, []);
90 typeArguments(reflect(new NonGenericMixinApplication2()).type, []);
91 typeArguments(
92 reflect(new GenericMixinApplication1<bool>()).type, [reflectClass(bool)]);
93 typeArguments(
94 reflect(new GenericMixinApplication2<bool>()).type, [reflectClass(bool)]);
95 typeArguments(reflect(new NonGenericClass1()).type, []);
96 typeArguments(reflect(new NonGenericClass2()).type, []);
97 typeArguments(reflect(new GenericClass1<bool>()).type, [reflectClass(bool)]);
98 typeArguments(reflect(new GenericClass2<bool>()).type, [reflectClass(bool)]);
99 typeArguments(reflect(new GenericMultipleMixins<bool, String, int>()).type,
100 [reflectClass(bool), reflectClass(String), reflectClass(int)]);
101 // Anonymous mixin applications have no type parameters or type arguments.
102 typeArguments(reflect(new NonGenericClass1()).type.superclass, []);
103 typeArguments(reflect(new NonGenericClass2()).type.superclass, []);
104 typeArguments(reflect(new GenericClass1<bool>()).type.superclass, []);
105 typeArguments(reflect(new GenericClass2<bool>()).type.superclass, []);
106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698