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

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

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

Powered by Google App Engine
This is Rietveld 408576698