| Index: tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart
|
| diff --git a/tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart b/tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart
|
| index c6f2b1698255c8228bb1564ab33e0cc291acd999..30bea68fecc273f785fc1f1fac4326df186971a5 100644
|
| --- a/tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart
|
| +++ b/tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart
|
| @@ -12,10 +12,21 @@ import 'generics_helper.dart';
|
|
|
| class Super<T, R extends T> {}
|
|
|
| -class Fixed extends Super<num, int> {}
|
| -class Generic<X, Y> extends Super<X, Y> {} /// 02: static type warning
|
| +class HelperNum {}
|
| +class HelperInt extends HelperNum {}
|
| +class Fixed extends Super<HelperNum, HelperInt> {}
|
| +class Generic<X, Y> extends Super<X, Y> {}
|
| class Malbounded extends Super<num, String> {} /// 01: static type warning
|
|
|
| +bool inCheckedMode() {
|
| + try {
|
| + int i = 'string';
|
| + } catch(e) {
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| main() {
|
| ClassMirror superDecl = reflectClass(Super);
|
| ClassMirror superOfNumAndInt = reflectClass(Fixed).superclass;
|
| @@ -23,18 +34,28 @@ main() {
|
| ClassMirror superOfXAndY = genericDecl.superclass; /// 02: continued
|
| ClassMirror genericOfNumAndDouble = reflect(new Generic<num, double>()).type; /// 02: continued
|
| ClassMirror superOfNumAndDouble = genericOfNumAndDouble.superclass; /// 02: continued
|
| - ClassMirror genericOfNumAndBool = reflect(new Generic<num, bool>()).type; /// 02: static type warning, dynamic type error
|
| - ClassMirror superOfNumAndBool = genericOfNumAndBool.superclass; /// 02: continued
|
| ClassMirror superOfNumAndString = reflectClass(Malbounded).superclass; /// 01: continued
|
|
|
| + try {
|
| + ClassMirror genericOfNumAndBool = reflect(new Generic<num, bool>()).type; /// 02: static type warning
|
| + ClassMirror superOfNumAndBool = genericOfNumAndBool.superclass; /// 02: continued
|
| + Expect.isFalse(genericOfNumAndBool.isOriginalDeclaration); /// 02: continued
|
| + Expect.isFalse(superOfNumAndBool.isOriginalDeclaration); /// 02: continued
|
| + typeParameters(genericOfNumAndBool, [#X, #Y]); /// 02: continued
|
| + typeParameters(superOfNumAndBool, [#T, #R]); /// 02: continued
|
| + typeArguments(genericOfNumAndBool, [reflectClass(num), reflectClass(bool)]); /// 02: continued
|
| + typeArguments(superOfNumAndBool, [reflectClass(num), reflectClass(bool)]); /// 02: continued
|
| + Expect.isFalse(inCheckedMode()); /// 02: continued
|
| + } on TypeError catch(e) {
|
| + Expect.isTrue(inCheckedMode());
|
| + }
|
| +
|
| Expect.isTrue(superDecl.isOriginalDeclaration);
|
| Expect.isFalse(superOfNumAndInt.isOriginalDeclaration);
|
| Expect.isTrue(genericDecl.isOriginalDeclaration); /// 02: continued
|
| Expect.isFalse(superOfXAndY.isOriginalDeclaration); /// 02: continued
|
| Expect.isFalse(genericOfNumAndDouble.isOriginalDeclaration); /// 02: continued
|
| Expect.isFalse(superOfNumAndDouble.isOriginalDeclaration); /// 02: continued
|
| - Expect.isFalse(genericOfNumAndBool.isOriginalDeclaration); /// 02: continued
|
| - Expect.isFalse(superOfNumAndBool.isOriginalDeclaration); /// 02: continued
|
| Expect.isFalse(superOfNumAndString.isOriginalDeclaration); /// 01: continued
|
|
|
| TypeVariableMirror tFromSuper = superDecl.typeVariables[0];
|
| @@ -53,17 +74,14 @@ main() {
|
| typeParameters(superOfXAndY, [#T, #R]); /// 02: continued
|
| typeParameters(genericOfNumAndDouble, [#X, #Y]); /// 02: continued
|
| typeParameters(superOfNumAndDouble, [#T, #R]); /// 02: continued
|
| - typeParameters(genericOfNumAndBool, [#X, #Y]); /// 02: continued
|
| - typeParameters(superOfNumAndBool, [#T, #R]); /// 02: continued
|
| typeParameters(superOfNumAndString, [#T, #R]); /// 01: continued
|
|
|
| typeArguments(superDecl, []);
|
| - typeArguments(superOfNumAndInt, [reflectClass(num), reflectClass(int)]);
|
| + typeArguments(superOfNumAndInt, [reflect(new HelperNum()).type,
|
| + reflect(new HelperInt()).type]);
|
| typeArguments(genericDecl, []); /// 02: continued
|
| typeArguments(superOfXAndY, [xFromGeneric, yFromGeneric]); /// 02: continued
|
| typeArguments(genericOfNumAndDouble, [reflectClass(num), reflectClass(double)]); /// 02: continued
|
| typeArguments(superOfNumAndDouble, [reflectClass(num), reflectClass(double)]); /// 02: continued
|
| - typeArguments(genericOfNumAndBool, [reflectClass(num), reflectClass(bool)]); /// 02: continued
|
| - typeArguments(superOfNumAndBool, [reflectClass(num), reflectClass(bool)]); /// 02: continued
|
| typeArguments(superOfNumAndString, [reflectClass(num), reflectClass(String)]); /// 01: continued
|
| }
|
|
|