Index: test/generated_sdk/lib/core/list.dart |
diff --git a/test/generated_sdk/lib/core/list.dart b/test/generated_sdk/lib/core/list.dart |
index e87bbcd9031d8cada2f1e5f25864efac2918f249..638cc03a2197392deebbea20e3af5ced5911fbe6 100644 |
--- a/test/generated_sdk/lib/core/list.dart |
+++ b/test/generated_sdk/lib/core/list.dart |
@@ -77,17 +77,22 @@ abstract class List<E> implements Iterable<E>, EfficientLength { |
* The [length] must not be negative or null, if it is provided. |
*/ |
factory List([int length]) { |
+ dynamic list; |
if (length == null) { |
- return JS('', '[]'); |
- } |
- // Explicit type test is necessary to guard against JavaScript conversions |
- // in unchecked mode. |
- if ((length is !int) || (length < 0)) { |
- throw new ArgumentError("Length must be a non-negative integer: $length"); |
+ list = JS('', '[]'); |
+ } else { |
+ // Explicit type test is necessary to guard against JavaScript conversions |
+ // in unchecked mode. |
+ if ((length is !int) || (length < 0)) { |
+ throw new ArgumentError("Length must be a non-negative integer: $length"); |
+ } |
+ list = JS('', 'new Array(#)', length); |
+ // TODO(jmesserly): consider a fixed array subclass instead. |
+ JS('void', r'#.fixed$length = Array', list); |
} |
- var list = JS('', 'new Array(#)', length); |
- // TODO(jmesserly): consider a fixed array subclass instead. |
- JS('void', r'#.fixed$length = Array', list); |
+ // TODO(jmesserly): skip this when E is dynamic and Object. |
+ JS('void', 'dart.setType(#, List\$(#))', list, E); |
+ // TODO(jmesserly): compiler creates a bogus type check here. |
return list; |
} |
@@ -100,7 +105,7 @@ abstract class List<E> implements Iterable<E>, EfficientLength { |
* The [length] must not be negative or null. |
*/ |
factory List.filled(int length, E fill) { |
- List result = new JSArray<E>.fixed(length); |
+ List result = new List<E>(length); |
if (length != 0 && fill != null) { |
for (int i = 0; i < result.length; i++) { |
result[i] = fill; |