Are you not able to use `remember` with an inlined...
# compose
b
Are you not able to use
remember
with an inlined Compose function?
Copy code
@Composable
inline fun test() {
    val i by remember { mutableStateOf(3) }
}
This method produces a nasty compiler error Part of the error message:
Copy code
Caused by: java.lang.RuntimeException: Exception while generating code for:
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit [inline]
  annotations:
    Composable
  BLOCK_BODY
    VAR name:$i$f$test type:<http://kotlin.Int|kotlin.Int> [val]
      CONST Int type=<http://kotlin.Int|kotlin.Int> value=0
    VAR name:i type:<http://kotlin.Int|kotlin.Int> [val]
      CALL 'public final fun remember <T> (calculation: @[ComposableContract(restartable = <null>, readonly = <null>, tracked = <null>, preventCapture = 'true')] kotlin.Function0<T of androidx.compose.runtime.RememberKt.remember>): T of androidx.compose.runtime.RememberKt.remember [inline] declared in androidx.compose.runtime.RememberKt' type=<http://kotlin.Int|kotlin.Int> origin=null
        <T>: <http://kotlin.Int|kotlin.Int>
        calculation: BLOCK type=kotlin.Function0<kotlin.Int> origin=LAMBDA
          COMPOSITE type=kotlin.Unit origin=null
          FUNCTION_REFERENCE 'private final fun test$lambda-0 (): <http://kotlin.Int|kotlin.Int> declared in dev.birdsofparadise.mua.lifecycle.ComposeActivityKt' type=kotlin.Function0<kotlin.Int> origin=LAMBDA reflectionTarget=null
v
It seems to me it works fine ( 7.0.0-alpha03, kotlin-plugin 14.21, compose alpha-09)
b
What gradle version are you using?
v
Copy code
gradle-6.8-rc-4
b
thank you testing it out
Hmm after switching to updated gradle version and android-gradle plugin
I'm getting an error that says
Configuration with name 'testApi' not found.
v
s
‘testApi not found’ is a known issue with, check out this thread https://kotlinlang.slack.com/archives/C3PQML5NU/p1608717793409300
b
Oh thanks!
@Val Salamakha Are you positive the code I listed compiles for you? I've upgraded and it doesn't fix it
Hmm I get it even if I remove inilne
Oof if I create a new project with exactly the same set up, just not MP it works