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

Side by Side Diff: test/codegen/lib/mirrors/generic_mixin_applications_test.dart

Issue 2265533002: Add mirrors tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 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 class Mixin<M> {}
15 class Nixim<N> {}
16
17 class NonGenericMixinApplication1 = Super with Mixin;
18 class NonGenericMixinApplication2 = Super<num> with Mixin<String>;
19
20 class GenericMixinApplication1<MA> = Super<MA> with Mixin<MA>;
21 class GenericMixinApplication2<MA> = Super<num> with Mixin<String>;
22
23 class NonGenericClass1 extends Super with Mixin {}
24 class NonGenericClass2 extends Super<num> with Mixin<String> {}
25
26 class GenericClass1<C> extends Super<C> with Mixin<C> {}
27 class GenericClass2<C> extends Super<num> with Mixin<String> {}
28
29 class GenericMultipleMixins<A, B, C> extends Super<A> with Mixin<B>, Nixim<C> {}
30
31 main() {
32 TypeMirror dynamicMirror = currentMirrorSystem().dynamicType;
33
34 // Declarations.
35 typeParameters(reflectClass(NonGenericMixinApplication1), []);
36 typeParameters(reflectClass(NonGenericMixinApplication2), []);
37 typeParameters(reflectClass(GenericMixinApplication1), [#MA]);
38 typeParameters(reflectClass(GenericMixinApplication2), [#MA]);
39 typeParameters(reflectClass(NonGenericClass1), []);
40 typeParameters(reflectClass(NonGenericClass2), []);
41 typeParameters(reflectClass(GenericClass1), [#C]);
42 typeParameters(reflectClass(GenericClass2), [#C]);
43 typeParameters(reflectClass(GenericMultipleMixins), [#A, #B, #C]);
44 // Anonymous mixin applications have no type parameters or type arguments.
45 typeParameters(reflectClass(NonGenericClass1).superclass, []);
46 typeParameters(reflectClass(NonGenericClass2).superclass, []);
47 typeParameters(reflectClass(GenericClass1).superclass, []);
48 typeParameters(reflectClass(GenericClass2).superclass, []);
49
50 typeArguments(reflectClass(NonGenericMixinApplication1), []);
51 typeArguments(reflectClass(NonGenericMixinApplication2), []);
52 typeArguments(reflectClass(GenericMixinApplication1), []);
53 typeArguments(reflectClass(GenericMixinApplication2), []);
54 typeArguments(reflectClass(NonGenericClass1), []);
55 typeArguments(reflectClass(NonGenericClass2), []);
56 typeArguments(reflectClass(GenericClass1), []);
57 typeArguments(reflectClass(GenericClass2), []);
58 typeArguments(reflectClass(GenericMultipleMixins), []);
59 // Anonymous mixin applications have no type parameters or type arguments.
60 typeArguments(reflectClass(NonGenericClass1).superclass.originalDeclaration, [ ]);
61 typeArguments(reflectClass(NonGenericClass2).superclass.originalDeclaration, [ ]);
62 typeArguments(reflectClass(GenericClass1).superclass.originalDeclaration, []);
63 typeArguments(reflectClass(GenericClass2).superclass.originalDeclaration, []);
64
65
66 // Instantiations.
67 typeParameters(reflect(new NonGenericMixinApplication1()).type, []);
68 typeParameters(reflect(new NonGenericMixinApplication2()).type, []);
69 typeParameters(reflect(new GenericMixinApplication1<bool>()).type, [#MA]);
70 typeParameters(reflect(new GenericMixinApplication2<bool>()).type, [#MA]);
71 typeParameters(reflect(new NonGenericClass1()).type, []);
72 typeParameters(reflect(new NonGenericClass2()).type, []);
73 typeParameters(reflect(new GenericClass1<bool>()).type, [#C]);
74 typeParameters(reflect(new GenericClass2<bool>()).type, [#C]);
75 typeParameters(reflect(new GenericMultipleMixins<bool, String, int>()).type, [ #A, #B, #C]);
76 // Anonymous mixin applications have no type parameters or type arguments.
77 typeParameters(reflect(new NonGenericClass1()).type.superclass, []);
78 typeParameters(reflect(new NonGenericClass2()).type.superclass, []);
79 typeParameters(reflect(new GenericClass1<bool>()).type.superclass, []);
80 typeParameters(reflect(new GenericClass2<bool>()).type.superclass, []);
81
82 typeArguments(reflect(new NonGenericMixinApplication1()).type, []);
83 typeArguments(reflect(new NonGenericMixinApplication2()).type, []);
84 typeArguments(reflect(new GenericMixinApplication1<bool>()).type, [reflectClas s(bool)]);
85 typeArguments(reflect(new GenericMixinApplication2<bool>()).type, [reflectClas s(bool)]);
86 typeArguments(reflect(new NonGenericClass1()).type, []);
87 typeArguments(reflect(new NonGenericClass2()).type, []);
88 typeArguments(reflect(new GenericClass1<bool>()).type, [reflectClass(bool)]);
89 typeArguments(reflect(new GenericClass2<bool>()).type, [reflectClass(bool)]);
90 typeArguments(reflect(new GenericMultipleMixins<bool, String, int>()).type, [r eflectClass(bool), reflectClass(String), reflectClass(int)]);
91 // Anonymous mixin applications have no type parameters or type arguments.
92 typeArguments(reflect(new NonGenericClass1()).type.superclass, []);
93 typeArguments(reflect(new NonGenericClass2()).type.superclass, []);
94 typeArguments(reflect(new GenericClass1<bool>()).type.superclass, []);
95 typeArguments(reflect(new GenericClass2<bool>()).type.superclass, []);
96 }
OLDNEW
« no previous file with comments | « test/codegen/lib/mirrors/generic_local_function_test.dart ('k') | test/codegen/lib/mirrors/generic_mixin_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698