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

Unified Diff: tests/language/generic_methods_type_expression_test.dart

Issue 2257813003: Add test case for type with partial parameterization by method type parameter (Closed) Base URL: https://github.com/dart-lang/sdk.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 side-by-side diff with in-line comments
Download patch
Index: tests/language/generic_methods_type_expression_test.dart
diff --git a/tests/language/generic_methods_type_expression_test.dart b/tests/language/generic_methods_type_expression_test.dart
index cbe08026c4f5fb7743a57f4c3e6910d5097ae462..70e17739d9839f2078f8387ea6af777d5a7fc9fb 100644
--- a/tests/language/generic_methods_type_expression_test.dart
+++ b/tests/language/generic_methods_type_expression_test.dart
@@ -32,6 +32,13 @@ class TypeValue<X> {
Type f8<T>() => new TypeValue<List<T>>().value;
+bool f9<T>(Object o) => o is Map<T, String>;
+
+class IsMap<A> {
+ @NoInline()
+ bool check<B>(o) => o is Map<A, B>;
+}
+
main() {
String s = "Hello!";
List<String> ss = <String>[s];
@@ -49,4 +56,11 @@ main() {
Expect.equals(f6<int>(ss), ss); // `as List<dynamic>` succeeds.
Expect.throws(() => f7<int>(), (e) => e is TypeError);
Expect.equals(f8<int>(), List); // Returns `List<dynamic>`.
+
+ Expect.isTrue(f9<int>(<int,String>{}));
+ Expect.isTrue(f9<int>(<bool,String>{})); // `is Map<dynamic, String>` is true.
+ Expect.isFalse(f9<int>(<int,int>{}));
+
+ Expect.isTrue(new IsMap<int>().check<String>(<int,String>{}));
+ Expect.isTrue(new IsMap<int>().check<int>(<int,String>{}));
}
« pkg/compiler/lib/src/ssa/builder.dart ('K') | « tests/language/generic_methods_new_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698