Skip to content

Commit 29a2890

Browse files
authored
Update KotlinControlStructuresTarget for Kotlin 1.5 (#1180)
for-loop with range expression whose bounds are constants with end less than start is folded into nop by Kotlin compiler version 1.5, without constants in for-loops behaviour is the same for compiler version 1.5 as for earlier versions.
1 parent acce036 commit 29a2890

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinControlStructuresTarget.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ object KotlinControlStructuresTarget {
7272

7373
private fun missedForBlock() {
7474

75-
for (j in 0..-1) { // assertPartlyCovered(1, 1)
75+
for (j in i2()..i1()) { // assertPartlyCovered(3, 1)
7676
nop() // assertNotCovered()
7777
}
7878

7979
}
8080

8181
private fun executedForBlock() {
8282

83-
for (j in 0..0) { // assertFullyCovered(0, 2)
83+
for (j in i1()..i2()) { // assertFullyCovered(1, 3)
8484
nop() // assertFullyCovered()
8585
}
8686

@@ -125,7 +125,7 @@ object KotlinControlStructuresTarget {
125125

126126
private fun continueStatement() {
127127

128-
for (j in 0..0) {
128+
for (j in i1()..i2()) {
129129
if (t()) {
130130
continue // assertFullyCovered()
131131
}

0 commit comments

Comments
 (0)