Ensure that no range instance is created for 'x in array.indices'

This commit is contained in:
Dmitry Petrov
2017-06-30 16:32:13 +03:00
parent 4320b63922
commit 5decf65d6a
7 changed files with 60 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
// WITH_RUNTIME
fun testPrimitiveArray(i: Int, ints: IntArray) = i in ints.indices
fun testObjectArray(i: Int, xs: Array<Any>) = i in xs.indices
// 0 INVOKESTATIC kotlin/collections/ArraysKt.getIndices
// 0 INVOKEVIRTUAL kotlin/ranges/IntRange.contains
// 2 ARRAYLENGTH