Ensure that {Collection, CharSequence}.indices intrinsic works with 'in'

This commit is contained in:
Dmitry Petrov
2017-06-30 18:11:44 +03:00
parent ec99fa2142
commit 36cbc0defd
9 changed files with 107 additions and 0 deletions
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun testCharSequence(i: Int, cs: CharSequence) = i in cs.indices
// 0 INVOKESTATIC kotlin/text/StringsKt.getIndices
// 0 INVOKEVIRTUAL kotlin/ranges/IntRange.contains
// 1 INVOKEINTERFACE java/lang/CharSequence.length
@@ -0,0 +1,7 @@
// WITH_RUNTIME
fun testCollection(i: Int, xs: List<Any>) = i in xs.indices
// 0 INVOKESTATIC kotlin/collections/CollectionsKt.getIndices
// 0 INVOKEVIRTUAL kotlin/ranges/IntRange.contains
// 1 INVOKEINTERFACE java/util/Collection.size