Handle withIndex() on arrays and CharSequences in ForLoopsLowering.
This commit is contained in:
committed by
max-kammerer
parent
735535dd5a
commit
a54d9482dd
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
val arr = arrayOf("a", "b", "c", "d")
|
||||
|
||||
fun box(): String {
|
||||
@@ -19,3 +18,6 @@ fun box(): String {
|
||||
// 0 component1
|
||||
// 0 component2
|
||||
// 1 ARRAYLENGTH
|
||||
|
||||
// The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop.
|
||||
// 2 ICONST_0
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
val arr = arrayOf("a", "b", "c", "d")
|
||||
|
||||
fun box(): String {
|
||||
@@ -19,3 +18,6 @@ fun box(): String {
|
||||
// 0 component1
|
||||
// 0 component2
|
||||
// 1 ARRAYLENGTH
|
||||
|
||||
// The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop.
|
||||
// 2 ICONST_0
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
val arr = intArrayOf()
|
||||
|
||||
fun box(): String {
|
||||
@@ -16,3 +15,6 @@ fun box(): String {
|
||||
// 0 component1
|
||||
// 0 component2
|
||||
// 1 ARRAYLENGTH
|
||||
|
||||
// The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop.
|
||||
// 2 ICONST_0
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
val arr = intArrayOf(10, 20, 30, 40)
|
||||
|
||||
fun box(): String {
|
||||
@@ -17,3 +16,6 @@ fun box(): String {
|
||||
// 0 component1
|
||||
// 0 component2
|
||||
// 1 ARRAYLENGTH
|
||||
|
||||
// The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop.
|
||||
// 2 ICONST_0
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
val arr = arrayOf("a", "b", "c", "d")
|
||||
|
||||
fun box(): String {
|
||||
@@ -19,3 +18,6 @@ fun box(): String {
|
||||
// 0 component1
|
||||
// 0 component2
|
||||
// 1 ARRAYLENGTH
|
||||
|
||||
// The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop.
|
||||
// 2 ICONST_0
|
||||
|
||||
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
val cs: CharSequence = "abcd"
|
||||
|
||||
fun box(): String {
|
||||
@@ -20,3 +19,6 @@ fun box(): String {
|
||||
// 0 component2
|
||||
// 1 length
|
||||
// 1 charAt
|
||||
|
||||
// The ICONST_0 is for initializing the index in the lowered for-loop.
|
||||
// 1 ICONST_0
|
||||
|
||||
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
fun box(): String {
|
||||
for ((index, x) in "".withIndex()) {
|
||||
return "Loop over empty String should not be executed"
|
||||
@@ -14,3 +13,6 @@ fun box(): String {
|
||||
// 0 component2
|
||||
// 1 length
|
||||
// 1 charAt
|
||||
|
||||
// The ICONST_0 is for initializing the index in the lowered for-loop.
|
||||
// 1 ICONST_0
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
fun box(): String {
|
||||
val s = StringBuilder()
|
||||
|
||||
@@ -18,3 +17,6 @@ fun box(): String {
|
||||
// 0 component2
|
||||
// 1 length
|
||||
// 1 charAt
|
||||
|
||||
// The ICONST_0 is for initializing the index in the lowered for-loop.
|
||||
// 1 ICONST_0
|
||||
|
||||
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
val xs = "abcd"
|
||||
|
||||
fun box(): String {
|
||||
@@ -20,3 +19,6 @@ fun box(): String {
|
||||
// 0 component2
|
||||
// 1 length
|
||||
// 1 charAt
|
||||
|
||||
// The ICONST_0 is for initializing the index in the lowered for-loop.
|
||||
// 1 ICONST_0
|
||||
|
||||
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
val xs = "abcd"
|
||||
|
||||
fun box(): String {
|
||||
@@ -20,3 +19,6 @@ fun box(): String {
|
||||
// 0 component2
|
||||
// 1 length
|
||||
// 1 charAt
|
||||
|
||||
// The ICONST_0 is for initializing the index in the lowered for-loop.
|
||||
// 1 ICONST_0
|
||||
|
||||
+3
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
val xs = "abcd"
|
||||
|
||||
fun useAny(x: Any) {}
|
||||
@@ -23,3 +22,6 @@ fun box(): String {
|
||||
// 0 component2
|
||||
// 1 length
|
||||
// 1 charAt
|
||||
|
||||
// The ICONST_0 is for initializing the index in the lowered for-loop.
|
||||
// 1 ICONST_0
|
||||
|
||||
Reference in New Issue
Block a user