Update test corelib_2/iterable_to_list_test for Dart 2 type inference
According to Leaf, Dart 2 type inference prefers to infer type
which is asked for, even if a more specific type can be inferred
from arguments.
It means that for
testIterable({"x": 1, "y": 1}.keys, ["x", "y"]);
where
testIterable(Iterable iterable, List expected, [int depth = 0])
the inferred type of map is Map<String, int>, but inferred type
of list is List (as testIterable argument type is List).
So this test is fixed by specifying type arguments of 'expected'
lists explicitly.
Change-Id: I2deab160038ee7abaad587920cb8fc620e09ebdf
Reviewed-on: https://dart-review.googlesource.com/39441
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index 335486b..fa02dc6c 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -182,7 +182,8 @@
from_environment_const_type_undefined_test/08: MissingCompileTimeError
iterable_return_type_test/01: RuntimeError
iterable_return_type_test/02: RuntimeError
-iterable_to_list_test/01: RuntimeError
+iterable_to_list_test/01: Crash # Wrong number of template arguments, given 2, expected 1
+iterable_to_list_test/none: Crash # Wrong number of template arguments, given 2, expected 1
list_replace_range_test: RuntimeError # Issue 32010
list_test/01: Crash # Unsupported operation: Unsupported type parameter type node T.
list_test/none: Crash # Unsupported operation: Unsupported type parameter type node T.
@@ -199,7 +200,8 @@
[ $compiler == dart2js && $dart2js_with_kernel && $fast_startup && $strong ]
iterable_return_type_test/01: RuntimeError
iterable_return_type_test/02: RuntimeError
-iterable_to_list_test/01: RuntimeError
+iterable_to_list_test/01: Crash # Wrong number of template arguments, given 2, expected 1
+iterable_to_list_test/none: Crash # Wrong number of template arguments, given 2, expected 1
list_test/01: Crash # Unsupported operation: Unsupported type parameter type node T.
list_test/none: Crash # Unsupported operation: Unsupported type parameter type node T.
map_test: Crash # tests/corelib_2/map_test.dart:903:7: Internal problem: Unhandled Null in installDefaultConstructor.
@@ -378,8 +380,6 @@
iterable_fold_test/02: RuntimeError
iterable_reduce_test/01: CompileTimeError # Issue 31533
iterable_reduce_test/none: RuntimeError
-iterable_to_list_test/01: RuntimeError
-iterable_to_list_test/none: RuntimeError
null_nosuchmethod_test/01: CompileTimeError # Issue 31402 (Invocation arguments)
null_nosuchmethod_test/none: CompileTimeError # Issue 31402 (Invocation arguments)
symbol_operator_test/03: RuntimeError # Issues 11669 and 31936 - throwing const constructors.
@@ -394,8 +394,6 @@
iterable_fold_test/02: RuntimeError
iterable_reduce_test/01: CompileTimeError # Issue 31533
iterable_reduce_test/none: RuntimeError
-iterable_to_list_test/01: RuntimeError
-iterable_to_list_test/none: RuntimeError
null_nosuchmethod_test/01: CompileTimeError # Issue 31402 (Invocation arguments)
null_nosuchmethod_test/none: CompileTimeError # Issue 31402 (Invocation arguments)
regexp/stack-overflow_test: RuntimeError
@@ -472,7 +470,6 @@
integer_to_radix_string_test: RuntimeError # Issue 29921
integer_to_string_test/01: RuntimeError # Issue 29921
iterable_return_type_test/02: RuntimeError # Issue 29921
-iterable_to_list_test/*: RuntimeError
list_concurrent_modify_test: RuntimeError # DDC uses ES6 array iterators so it does not issue this
list_removeat_test: RuntimeError # Issue 29921
main_test: RuntimeError # Issue 29921
diff --git a/tests/corelib_2/iterable_to_list_test.dart b/tests/corelib_2/iterable_to_list_test.dart
index d812978..4ceb6c8 100644
--- a/tests/corelib_2/iterable_to_list_test.dart
+++ b/tests/corelib_2/iterable_to_list_test.dart
@@ -9,16 +9,16 @@
main() {
// testIterable takes an iterable and a list expected to be equal to
// the iterable's toList result, including the type parameter of the list.
- testIterable([], []);
+ testIterable(<dynamic>[], <dynamic>[]);
testIterable(<int>[], <int>[]);
testIterable(<String>[], <String>[]);
testIterable([1, 2, 3], [1, 2, 3]);
testIterable(<int>[1, 2, 3], <int>[1, 2, 3]);
testIterable(const [1, 2], [1, 2]);
testIterable(const <int>[1, 2], <int>[1, 2]);
- testIterable({"x": 1, "y": 1}.keys, ["x", "y"]);
+ testIterable(<dynamic, dynamic>{"x": 1, "y": 1}.keys, <dynamic>["x", "y"]);
testIterable(<String, int>{"x": 1, "y": 1}.keys, <String>["x", "y"]);
- testIterable({"x": 2, "y": 3}.values, [2, 3]);
+ testIterable(<dynamic, dynamic>{"x": 2, "y": 3}.values, <dynamic>[2, 3]);
testIterable(<String, int>{"x": 2, "y": 3}.values, <int>[2, 3]);
testIterable(new Iterable.generate(3), [0, 1, 2]);
testIterable(new Iterable<int>.generate(3), <int>[0, 1, 2]);
@@ -29,9 +29,9 @@
testIterable(new Queue.from([1, 2, 3]), [1, 2, 3]);
testIterable(new Queue<int>.from(<int>[1, 2, 3]), <int>[1, 2, 3]);
testIterable(new Uint8List.fromList(<int>[1, 2, 3]), // //# 01: ok
- <int>[1, 2, 3]); // //# 01: continued
+ <int>[1, 2, 3]); // //# 01: continued
testIterable(new Float32List.fromList([1.0, 2.0, 3.0]), // //# 01: continued
- <double>[1.0, 2.0, 3.0]); // //# 01: continued
+ <double>[1.0, 2.0, 3.0]); // //# 01: continued
testIterable("abc".codeUnits, <int>[97, 98, 99]); // //# 01: continued
testIterable("abc".runes, <int>[97, 98, 99]);
}