mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
KT-6916: do not create Progression instances in for-in-downTo loops
This commit is contained in:
15
compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt
vendored
Normal file
15
compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(): Int {
|
||||
var sum = 0
|
||||
for (i in 4 downTo 1) {
|
||||
sum = sum * 10 + i
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
// 0 iterator
|
||||
// 0 getStart
|
||||
// 0 getEnd
|
||||
// 0 getFirst
|
||||
// 0 getLast
|
||||
@@ -1,7 +1,8 @@
|
||||
fun f() {
|
||||
for (i in 0..5 step 2) {
|
||||
}
|
||||
for (i in 5 downTo 1) {
|
||||
|
||||
for (i in 5 downTo 1 step 1) { // suppress optimized code generation for 'for-in-downTo'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user