Kotlin 1.3.70 fails to compile savedState.required()
yamasa opened this issue · 1 comments
yamasa commented
class FooViewModel(savedState: SavedState) : AbstractViewModel() {
private val fooArg: String by savedState.required()
}
In Kotlin 1.3.70, compilation for the above code fails with an exception like this:
e: java.lang.IllegalStateException: Couldn't obtain compiled function body for
public final inline operator fun provideDelegate(thisRef: kotlin.Any?,
property: kotlin.reflect.KProperty<*>): com.linecorp.lich.viewmodel.InitializedSavedState<T>
defined in com.linecorp.lich.viewmodel.RequiringSavedStateDelegate[DeserializedSimpleFunctionDescriptor@72dd0f7d]
This seems to be due to a bug where the provideDelegate
function does not work well with inline classes.
https://kotlinlang.org/docs/reference/delegated-properties.html#providing-a-delegate-since-11
https://kotlinlang.org/docs/reference/inline-classes.html