一个奇葩的bug,关于Backend Internal error: Exception during IR lowering

// viewmodel中定义两个数据
class LoginViewModel @Inject constructor() : BaseViewModel<LoginIntent>() {
    val height = MutableStateFlow(-1f)
    val weight = MutableStateFlow(-1f)
}

// UI中使用该数据做判定:
BaseLoginScreen(
	canNextClick = vm.weight.collectAsState().value!=-1f && vm.weight.collectAsState().value!=-1f,
) { 。。。 }
// 此时会报错,提示Backend Internal error: Exception during IR lowering,还有Runtime JAR files in the classpath should have the same version.

// 然而改成下面这种形式就对了:
val height = vm.weight.collectAsState().value
val weight = vm.weight.collectAsState().value
BaseLoginScreen(
	canNextClick = height!=-1f && weight!=-1f,
) { 。。。 }
posted @ 2022-02-23 10:20  李振欣  阅读(1879)  评论(0编辑  收藏  举报