| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.generic_mixin_applications; | 5 library test.generic_mixin_applications; |
| 6 | 6 |
| 7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
| 8 | 8 |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 | 10 |
| 11 import 'generics_test.dart'; | 11 import 'generics_test.dart'; |
| 12 | 12 |
| 13 class Super<S> {} | 13 class Super<S> {} |
| 14 class Mixin<M> {} | 14 class Mixin<M> {} |
| 15 class Nixim<N> {} | 15 class Nixim<N> {} |
| 16 | 16 |
| 17 typedef NonGenericMixinApplication1 = Super with Mixin; | 17 class NonGenericMixinApplication1 = Super with Mixin; |
| 18 typedef NonGenericMixinApplication2 = Super<num> with Mixin<String>; | 18 class NonGenericMixinApplication2 = Super<num> with Mixin<String>; |
| 19 | 19 |
| 20 typedef GenericMixinApplication1<MA> = Super<MA> with Mixin<MA>; | 20 class GenericMixinApplication1<MA> = Super<MA> with Mixin<MA>; |
| 21 typedef GenericMixinApplication2<MA> = Super<num> with Mixin<String>; | 21 class GenericMixinApplication2<MA> = Super<num> with Mixin<String>; |
| 22 | 22 |
| 23 class NonGenericClass1 extends Super with Mixin {} | 23 class NonGenericClass1 extends Super with Mixin {} |
| 24 class NonGenericClass2 extends Super<num> with Mixin<String> {} | 24 class NonGenericClass2 extends Super<num> with Mixin<String> {} |
| 25 | 25 |
| 26 class GenericClass1<C> extends Super<C> with Mixin<C> {} | 26 class GenericClass1<C> extends Super<C> with Mixin<C> {} |
| 27 class GenericClass2<C> extends Super<num> with Mixin<String> {} | 27 class GenericClass2<C> extends Super<num> with Mixin<String> {} |
| 28 | 28 |
| 29 class GenericMultipleMixins<A, B, C> extends Super<A> with Mixin<B>, Nixim<C> {} | 29 class GenericMultipleMixins<A, B, C> extends Super<A> with Mixin<B>, Nixim<C> {} |
| 30 | 30 |
| 31 main() { | 31 main() { |
| 32 TypeMirror dynamicMirror = currentMirrorSystem().dynamicType; | 32 TypeMirror dynamicMirror = currentMirrorSystem().dynamicType; |
| 33 | 33 |
| 34 // Declarations. | 34 // Declarations. |
| 35 typeParameters(reflectClass(NonGenericMixinApplication1), []); | 35 typeParameters(reflectClass(NonGenericMixinApplication1), []); |
| 36 typeParameters(reflectClass(NonGenericMixinApplication2), []); | 36 typeParameters(reflectClass(NonGenericMixinApplication2), []); |
| 37 typeParameters(reflectClass(GenericMixinApplication1), [#MA]); | 37 typeParameters(reflectClass(GenericMixinApplication1), [#MA]); |
| 38 typeParameters(reflectClass(GenericMixinApplication2), [#MA]); | 38 typeParameters(reflectClass(GenericMixinApplication2), [#MA]); |
| 39 typeParameters(reflectClass(NonGenericClass1), []); | 39 typeParameters(reflectClass(NonGenericClass1), []); |
| 40 typeParameters(reflectClass(NonGenericClass2), []); | 40 typeParameters(reflectClass(NonGenericClass2), []); |
| 41 typeParameters(reflectClass(GenericClass1), [#C]); | 41 typeParameters(reflectClass(GenericClass1), [#C]); |
| 42 typeParameters(reflectClass(GenericClass2), [#C]); | 42 typeParameters(reflectClass(GenericClass2), [#C]); |
| 43 typeParameters(reflectClass(GenericMultipleMixins), [#A, #B, #C]); | 43 typeParameters(reflectClass(GenericMultipleMixins), [#A, #B, #C]); |
| 44 // Anonymous mixin applications have no type parameters or type arguments. | 44 // Anonymous mixin applications have no type parameters or type arguments. |
| 45 typeParameters(reflectClass(NonGenericClass1).superclass, []); | 45 typeParameters(reflectClass(NonGenericClass1).superclass, []); |
| 46 typeParameters(reflectClass(NonGenericClass2).superclass, []); | 46 typeParameters(reflectClass(NonGenericClass2).superclass, []); |
| 47 typeParameters(reflectClass(GenericClass1).superclass, []); | 47 typeParameters(reflectClass(GenericClass1).superclass, []); |
| 48 typeParameters(reflectClass(GenericClass2).superclass, []); | 48 typeParameters(reflectClass(GenericClass2).superclass, []); |
| 49 | 49 |
| 50 typeArguments(reflectClass(NonGenericMixinApplication1), []); | 50 typeArguments(reflectClass(NonGenericMixinApplication1), []); |
| 51 typeArguments(reflectClass(NonGenericMixinApplication2), []); | 51 typeArguments(reflectClass(NonGenericMixinApplication2), []); |
| 52 typeArguments(reflectClass(GenericMixinApplication1), []); | 52 typeArguments(reflectClass(GenericMixinApplication1), []); |
| 53 typeArguments(reflectClass(GenericMixinApplication2), []); | 53 typeArguments(reflectClass(GenericMixinApplication2), []); |
| 54 typeArguments(reflectClass(NonGenericClass1), []); | 54 typeArguments(reflectClass(NonGenericClass1), []); |
| 55 typeArguments(reflectClass(NonGenericClass2), []); | 55 typeArguments(reflectClass(NonGenericClass2), []); |
| 56 typeArguments(reflectClass(GenericClass1), []); | 56 typeArguments(reflectClass(GenericClass1), []); |
| 57 typeArguments(reflectClass(GenericClass2), []); | 57 typeArguments(reflectClass(GenericClass2), []); |
| 58 typeArguments(reflectClass(GenericMultipleMixins), []); | 58 typeArguments(reflectClass(GenericMultipleMixins), []); |
| 59 // Anonymous mixin applications have no type parameters or type arguments. | 59 // Anonymous mixin applications have no type parameters or type arguments. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 typeParameters(reflect(new NonGenericClass1()).type, []); | 71 typeParameters(reflect(new NonGenericClass1()).type, []); |
| 72 typeParameters(reflect(new NonGenericClass2()).type, []); | 72 typeParameters(reflect(new NonGenericClass2()).type, []); |
| 73 typeParameters(reflect(new GenericClass1<bool>()).type, [#C]); | 73 typeParameters(reflect(new GenericClass1<bool>()).type, [#C]); |
| 74 typeParameters(reflect(new GenericClass2<bool>()).type, [#C]); | 74 typeParameters(reflect(new GenericClass2<bool>()).type, [#C]); |
| 75 typeParameters(reflect(new GenericMultipleMixins<bool, String, int>()).type, [
#A, #B, #C]); | 75 typeParameters(reflect(new GenericMultipleMixins<bool, String, int>()).type, [
#A, #B, #C]); |
| 76 // Anonymous mixin applications have no type parameters or type arguments. | 76 // Anonymous mixin applications have no type parameters or type arguments. |
| 77 typeParameters(reflect(new NonGenericClass1()).type.superclass, []); | 77 typeParameters(reflect(new NonGenericClass1()).type.superclass, []); |
| 78 typeParameters(reflect(new NonGenericClass2()).type.superclass, []); | 78 typeParameters(reflect(new NonGenericClass2()).type.superclass, []); |
| 79 typeParameters(reflect(new GenericClass1<bool>()).type.superclass, []); | 79 typeParameters(reflect(new GenericClass1<bool>()).type.superclass, []); |
| 80 typeParameters(reflect(new GenericClass2<bool>()).type.superclass, []); | 80 typeParameters(reflect(new GenericClass2<bool>()).type.superclass, []); |
| 81 | 81 |
| 82 typeArguments(reflect(new NonGenericMixinApplication1()).type, []); | 82 typeArguments(reflect(new NonGenericMixinApplication1()).type, []); |
| 83 typeArguments(reflect(new NonGenericMixinApplication2()).type, []); | 83 typeArguments(reflect(new NonGenericMixinApplication2()).type, []); |
| 84 typeArguments(reflect(new GenericMixinApplication1<bool>()).type, [reflectClas
s(bool)]); | 84 typeArguments(reflect(new GenericMixinApplication1<bool>()).type, [reflectClas
s(bool)]); |
| 85 typeArguments(reflect(new GenericMixinApplication2<bool>()).type, [reflectClas
s(bool)]); | 85 typeArguments(reflect(new GenericMixinApplication2<bool>()).type, [reflectClas
s(bool)]); |
| 86 typeArguments(reflect(new NonGenericClass1()).type, []); | 86 typeArguments(reflect(new NonGenericClass1()).type, []); |
| 87 typeArguments(reflect(new NonGenericClass2()).type, []); | 87 typeArguments(reflect(new NonGenericClass2()).type, []); |
| 88 typeArguments(reflect(new GenericClass1<bool>()).type, [reflectClass(bool)]); | 88 typeArguments(reflect(new GenericClass1<bool>()).type, [reflectClass(bool)]); |
| 89 typeArguments(reflect(new GenericClass2<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)]); | 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. | 91 // Anonymous mixin applications have no type parameters or type arguments. |
| 92 typeArguments(reflect(new NonGenericClass1()).type.superclass, []); | 92 typeArguments(reflect(new NonGenericClass1()).type.superclass, []); |
| 93 typeArguments(reflect(new NonGenericClass2()).type.superclass, []); | 93 typeArguments(reflect(new NonGenericClass2()).type.superclass, []); |
| 94 typeArguments(reflect(new GenericClass1<bool>()).type.superclass, []); | 94 typeArguments(reflect(new GenericClass1<bool>()).type.superclass, []); |
| 95 typeArguments(reflect(new GenericClass2<bool>()).type.superclass, []); | 95 typeArguments(reflect(new GenericClass2<bool>()).type.superclass, []); |
| 96 } | 96 } |
| OLD | NEW |