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

Unified Diff: tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart

Issue 47743011: Substitute types in generic superclasses and interfaces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased. Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/generic_bounded_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..92426d5ef32611392bb49ad80a54f5366edddef0 100644
--- a/tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart
+++ b/tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart
@@ -11,11 +11,20 @@ import 'package:expect/expect.dart';
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 Generic<X, Y> extends Super<X, Y> {} /// 02: static type warning
class Malbounded extends Super<num, String> {} /// 01: static type warning
+bool inCheckedMode() {
+ try {
+ var s = 'string';
+ int i = s;
+ } catch(e) {
+ return true;
+ }
+ return false;
+}
+
main() {
ClassMirror superDecl = reflectClass(Super);
ClassMirror superOfNumAndInt = reflectClass(Fixed).superclass;
@@ -23,18 +32,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,8 +72,6 @@ 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, []);
@@ -63,7 +80,5 @@ main() {
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
}
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/generic_bounded_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698