Hi, I’m experiencing something weird with the compose compiler.
Copy code
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.BlendMode
@Composable
fun TestBlendMode(
blendMode: BlendMode = BlendMode.Multiply
) {
// Comment this line and compilation should work as expected
val mode = blendMode
}
If i use a blendmode inside a composable, i get a crash. Anyone getting the same error with the 1.0.0 version?
Copy code
: java.lang.AssertionError: Assertion failed
at org.jetbrains.kotlin.ir.util.AdditionalIrUtilsKt.getPropertyGetter(AdditionalIrUtils.kt:236)
at androidx.compose.compiler.plugins.kotlin.lower.AbstractComposeLowering.unboxValueIfInline(AbstractComposeLowering.kt:311)
l
Lukas
08/17/2021, 11:13 AM
The Compose compiler seems to dislike BlendMode as a parameter in Composable functions. Replacing it with a wrapper object works as a band-aid fix
Copy code
enum class BlendModeWrapper(val blendMode: BlendMode) {
WrapperDstIn(BlendMode.DstIn)
}
fun TestBlendMode(blendMode: BlendModeWrapper) {
blendMode.blendMode
}