Norbi
10/03/2021, 3:11 PM@Composable
`fun`s work with Compose/Web?
I get internal compiler error in case of this function:
@Composable
fun <T> MySelect(
options: List<T>,
onChange: (T?) -> Unit
) ...
If I remove the generic type parameter (and replace T
with Any
in the parameters) then it compiles.
Kotlin: 1.5.31
Compose/Web: 1.0.0-alpha4-build366
Error message:
java.lang.IllegalStateException: FULL: FUN name:MySelect$composable visibility:public modality:FINAL <T> (options:kotlin.collections.List<T of ...component.MySelect$composable>, onChange:kotlin.Function1<T of ...component.MySelect$composable?, kotlin.Unit>, $composer:androidx.compose.runtime.Composer?, $changed:<http://kotlin.Int|kotlin.Int>) returnType:kotlin.Unit
Ir: ...component#MySelect$composable(kotlin.collections.List<0:0>;kotlin.Function1<0:0?,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int){0�<kotlin.Any?>}
Descriptor: ...component#MySelect$composable(kotlin.collections.List<0:0>;kotlin.Function1<0:0,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int){0�<kotlin.Any?>}
Norbi
10/03/2021, 3:22 PMolonho
10/04/2021, 5:17 AMNorbi
10/04/2021, 6:58 AMplugins {
kotlin("multiplatform")
id("org.jetbrains.compose") version "1.0.0-alpha4-build366"
}
But I have a plugin block in the root project:
plugins {
kotlin("multiplatform") version "1.5.31" apply false
kotlin("plugin.serialization") version "1.5.31" apply false
...
Is it disallowed as well to have an unapplied serialization plugin?Norbi
10/04/2021, 7:15 AMolonho
10/04/2021, 7:18 AMNorbi
10/04/2021, 8:20 AMkotlin("multiplatform")
) but it still fails with the same error message.
Isn't it suspicious that it works if I remove the type parameter?
These are the project.plugins
(printed from afterEvaluate
of the Compose/Web project):
• com.android.ide.gradle.model.builder.AndroidStudioToolingPlugin
• org.gradle.api.plugins.HelpTasksPlugin
• org.gradle.buildinit.plugins.BuildInitPlugin
• org.gradle.buildinit.plugins.WrapperPlugin
• org.jetbrains.compose.ComposeCompilerKotlinSupportPlugin
• org.jetbrains.compose.ComposePlugin
• org.gradle.language.base.plugins.LifecycleBasePlugin
• org.gradle.api.plugins.BasePlugin
• org.gradle.api.plugins.JvmEcosystemPlugin
• org.gradle.api.plugins.ReportingBasePlugin
• org.gradle.api.plugins.JavaBasePlugin$Inject
• org.jetbrains.kotlin.gradle.scripting.internal.ScriptingKotlinGradleSubplugin
• org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
• org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
• org.gradle.kotlin.dsl.provider.plugins.KotlinScriptBasePlugin
• org.jetbrains.kotlin.gradle.targets.js.npm.NpmResolverPlugin
As you see, the org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin
is not applied (it is applied only in a project that is a dependency of the Compose/Web project).Norbi
10/04/2021, 9:09 AM