Skip to content

Commit 7be1d77

Browse files
lrhncommit-bot@chromium.org
authored andcommitted
Remove invalid tests from set literal tests.
See #35300 Bug: http://dartbug.com/35300 Change-Id: I00610ce9eadc51499fc5f35d43095dbf29d07543 Reviewed-on: https://dart-review.googlesource.com/c/85740 Reviewed-by: Erik Ernst <[email protected]> Commit-Queue: Lasse R.H. Nielsen <[email protected]>
1 parent 16cfb6c commit 7be1d77

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

tests/language_2/set_literals/invalid_set_literal_test.dart

+9
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,13 @@ void main() {
6868
;
6969
Expect.isNull(o);
7070
}<int>(42);
71+
72+
<T extends Set<num>>() {
73+
// Regression test for http://dartbug.com/35300.
74+
// The `Set<Null>` type is not assignable to `T extends Set<num>`,
75+
// so we don't make this a set. You can't assign a map to `T`.
76+
T o //
77+
= {}; //# 28: compile-time error
78+
;
79+
}();
7180
}

tests/language_2/set_literals/set_literal_test.dart

+1-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void main() {
1313
test();
1414
}
1515

16-
void test<S extends Set<num>, I extends Iterable<num>>() {
16+
void test() {
1717
checkSet<T>(Object o, List elements) {
1818
Expect.type<LinkedHashSet<T>>(o);
1919
Set<T> set = o;
@@ -24,8 +24,6 @@ void test<S extends Set<num>, I extends Iterable<num>>() {
2424
Object iterableContext<T>(Iterable<T> object) => object;
2525
Object foSetContext<T>(FutureOr<Set<T>> object) => object;
2626
Object foIterableContext<T>(FutureOr<Iterable<T>> object) => object;
27-
Object sContext(S object) => object;
28-
Object iContext(I object) => object;
2927

3028
// Empty literal, no type arguments.
3129
// No context.
@@ -40,8 +38,6 @@ void test<S extends Set<num>, I extends Iterable<num>>() {
4038
checkSet<int>(iterableContext<int>({}), []);
4139
checkSet<int>(foSetContext<int>({}), []);
4240
checkSet<int>(foIterableContext<int>({}), []);
43-
checkSet<num>(sContext({}), []);
44-
checkSet<num>(iContext({}), []);
4541

4642
// Non-empty set literal, no type argument.
4743
// No context.
@@ -61,14 +57,10 @@ void test<S extends Set<num>, I extends Iterable<num>>() {
6157
checkSet<num>(iterableContext<num>({1}), [1]);
6258
checkSet<num>(foSetContext<num>({1}), [1]);
6359
checkSet<num>(foIterableContext<num>({1}), [1]);
64-
checkSet<num>(sContext({1}), [1]);
65-
checkSet<num>(iContext({1}), [1]);
6660
checkSet<num>(setContext<num>({3, 1, 2, 4, 1, 4}), [3, 1, 2, 4]);
6761
checkSet<num>(iterableContext<num>({3, 1, 2, 4, 1, 4}), [3, 1, 2, 4]);
6862
checkSet<num>(foSetContext<num>({3, 1, 2, 4, 1, 4}), [3, 1, 2, 4]);
6963
checkSet<num>(foIterableContext<num>({3, 1, 2, 4, 1, 4}), [3, 1, 2, 4]);
70-
checkSet<num>(sContext({3, 1, 2, 4, 1, 4}), [3, 1, 2, 4]);
71-
checkSet<num>(iContext({3, 1, 2, 4, 1, 4}), [3, 1, 2, 4]);
7264

7365
// Non-empty set literal with type argument.
7466
checkSet<num>(<num>{1}, [1]);

0 commit comments

Comments
 (0)