Skolson5903
09/30/2021, 5:28 PMorg.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: <path>/GridDisplay.kt
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.backend.common.lower.loops.RangeLoopTransformer.gatherLoopVariableInfo(ForLoopsLowering.kt:375)
Anyone else seen this? I started stripping stuff down and have a small function now that doesn't
do much but builds fine, then a change to one line causes the build to fail with this error.
I'll post the good code/failing code in a thread in case someone is interested. Weird.
Searches show a similar error when trying to use kotlinx serialization and compose in the same
module, but I don't have that scenario. My app does have three multi-platform modules using
serialization, but the app module specific to android and using compose does not use serialization.
Would this be a jetbrains defect or a Compose/google defect? Thanks in advance for any suggestions. FWIW this happens with kotlin 1.5.30 and compose 1.1.0-alpha04Skolson5903
09/30/2021, 5:31 PM@Composable
fun GridDisplayTest(
) {
Column(modifier = Modifier.fillMaxWidth()
) {
var skip: Boolean
for (rowIndex in 0 until 2) {
skip = false
Row(
modifier = Modifier
.fillMaxWidth()
) {
for (columnIndex in 0 until 4) {
if (skip) continue
val isLabel = columnIndex % 2 == 0
if (isLabel) {
Text("Any")
} else {
Text("Any2")
}
}
}
}
}
}
The above code build fails. If I change the one line (if/skip) line to the below, it builds fine:
@Composable
fun GridDisplayTest(
) {
Column(modifier = Modifier.fillMaxWidth()
) {
var skip: Boolean
for (rowIndex in 0 until 2) {
skip = false
Row(
modifier = Modifier
.fillMaxWidth()
) {
for (columnIndex in 0 until 4) {
if (!skip) {
val isLabel = columnIndex % 2 == 0
if (isLabel) {
Text("Any")
} else {
Text("Any2")
}
}
}
}
}
}
}
Something doesn't like the if/continue statement.Skolson5903
09/30/2021, 5:34 PM