-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS] Compile error when using delegated property with @Composable
getters in object
s
#3216
Comments
This was fixed in compose multiplatform compiler plugin 1.4.7-rc01. It will be included automatically in the next compose multiplatform release. It requires kotlin 1.8.21. For now it can be enabled like this: compose {
kotlinCompilerPlugin.set("org.jetbrains.compose.compiler:compiler:1.4.7-rc01")
// kotlinCompilerPluginArgs.add("suppressKotlinVersionCompatibilityCheck=1.8.20") // add this only if you want to use kotlin 1.8.20 instead of 1.8.21
} |
i think i have a simular problem.
I used compiler:1.4.7-rc01 & kotlin 1.8.21 but i have same error. |
Okay i get it. How to reproduce
package com.pkg
import androidx.compose.runtime.Composable
import androidx.compose.runtime.saveable.SaveableStateHolder
class Foo: SaveableStateHolder {
@Composable override fun SaveableStateProvider(key: Any, content: @Composable () -> Unit) {
}
override fun removeState(key: Any) {
}
override fun toString(): String {
return "bar"
}
}
var greetingText by remember { mutableStateOf("Hello, World! ${Foo()} ") } This simple case for overview. I never call SaveableStateHolder inheritance and I get an error message
i used
its not work for me. |
@jershell the problem you're describing is a bit different (it's not about a getter). Does your class need to be public? One of the workarounds is to make it internal if applicable in your case. |
@eymar I never call this class. I think some dependency call this class inside. I dont now how to search what a class do it. |
workaround
|
Hey everyone! compose {
kotlinCompilerPlugin.set("1.4.7")
} In the next release, setting |
Fixed in 1.4.3 |
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
Affected platforms
Select one of the platforms below:
Versions
Using the Compose for iOS template
To Reproduce
Sample code:
Error report
Additional context
This only happens with getter annotated with
@Composable
inobject
orcompanion object
of classes. Declare such functions at the top level of file won't cause this issue.The text was updated successfully, but these errors were encountered: