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

Unified Diff: tests/corelib/set_test.dart

Issue 1887883006: Fix Set.from which still had a generic type on the incoming Iterable. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 | « sdk/lib/collection/linked_hash_set.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/set_test.dart
diff --git a/tests/corelib/set_test.dart b/tests/corelib/set_test.dart
index 3711449d8fb4bbec9d8c153e13e8085986dfe4ca..20a136ad6abc6beae5a11f97c11d8d28219eb35d 100644
--- a/tests/corelib/set_test.dart
+++ b/tests/corelib/set_test.dart
@@ -445,6 +445,17 @@ void testCESetFrom(setFrom) {
Expect.isTrue(set4.isEmpty);
}
+class A {}
+class B {}
+class C implements A, B {}
+
+void testASetFrom(setFrom) {
+ List<B> bList= <B>[new C()];
+ // Set.from allows to cast elements.
+ Set<A> aSet = setFrom(bList);
+ Expect.isTrue(aSet.length == 1);
+}
+
main() {
testMain(() => new HashSet());
testMain(() => new LinkedHashSet());
@@ -508,4 +519,9 @@ main() {
testCESetFrom((x) => new SplayTreeSet<CE>.from(x,
customCompare(20), validKey));
testCESetFrom((x) => new SplayTreeSet<CE>.from(x, identityCompare));
+
+ testASetFrom((x) => new Set<A>.from(x));
+ testASetFrom((x) => new HashSet<A>.from(x));
+ testASetFrom((x) => new LinkedHashSet<A>.from(x));
+ testASetFrom((x) => new SplayTreeSet<A>.from(x));
}
« no previous file with comments | « sdk/lib/collection/linked_hash_set.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698