Index: sdk/lib/core/errors.dart |
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart |
index 144921a474ac8b98367eb32d50e9c6856c1c63c4..0e99b0b271ce48375f613c2fc9522aad6d0e5019 100644 |
--- a/sdk/lib/core/errors.dart |
+++ b/sdk/lib/core/errors.dart |
@@ -282,7 +282,8 @@ class RangeError extends ArgumentError { |
static void checkValidIndex(int index, var indexable, |
[String name, int length, String message]) { |
if (length == null) length = indexable.length; |
- if (index < 0 || index >= length) { |
+ // Comparing with `0` as receiver produces better dart2js type inference. |
+ if (0 > index || index >= length) { |
if (name == null) name = "index"; |
throw new RangeError.index(index, indexable, name, message, length); |
} |