Browse Source

Update compose compiler version to 1.5.10.2 (#4652)

version bump & test added for reified generic in composable functions

Fixes #3147
pull/4682/head v1.6.10-dev1593
Pavel Shishkin 7 months ago committed by GitHub
parent
commit
41a6d3d3c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      compose/integrations/composable-test-cases/gradle.properties
  2. 47
      compose/integrations/composable-test-cases/testcases/inheritance/composableInterface/main/src/commonTest/kotlin/CollectionOfComposablesTests.kt
  3. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposeCompilerCompatibility.kt
  4. 2
      gradle-plugins/gradle.properties

6
compose/integrations/composable-test-cases/gradle.properties

@ -1,11 +1,11 @@
org.gradle.jvmargs=-Xmx4096M -XX:MaxMetaspaceSize=512m org.gradle.jvmargs=-Xmx4096M -XX:MaxMetaspaceSize=512m
kotlin.code.style=official kotlin.code.style=official
android.useAndroidX=true android.useAndroidX=true
kotlin.version=1.9.22 kotlin.version=1.9.23
agp.version=7.3.0 agp.version=7.3.0
# a version of compose libraries. In this project the only dependency is compose-runtime. # a version of compose libraries. In this project the only dependency is compose-runtime.
compose.version=1.6.0-rc03 compose.version=1.6.1
# a group id for compose-runtime. Keep it as a parameter to easily change it on CI. # a group id for compose-runtime. Keep it as a parameter to easily change it on CI.
compose.runtime.groupId=org.jetbrains.compose.runtime compose.runtime.groupId=org.jetbrains.compose.runtime
@ -13,7 +13,7 @@ kotlinx.coroutines.version=1.8.0
#empty by default - a default version will be used #empty by default - a default version will be used
#compose.kotlinCompilerPluginVersion=23.12.18 #compose.kotlinCompilerPluginVersion=23.12.18
compose.kotlinCompilerPluginVersion=1.5.10.1 compose.kotlinCompilerPluginVersion=1.5.10.2
# default|failingJs - see enum class CasesToRun # default|failingJs - see enum class CasesToRun
tests.casesToRun=default tests.casesToRun=default

47
compose/integrations/composable-test-cases/testcases/inheritance/composableInterface/main/src/commonTest/kotlin/CollectionOfComposablesTests.kt

@ -4,6 +4,7 @@ import com.example.common.TextLeafNode
import com.example.common.composeText import com.example.common.composeText
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import kotlin.reflect.KClass
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
@ -45,7 +46,7 @@ class CollectionOfComposablesTests {
@Test @Test
fun testDefaultArgsForOverridden() = runTest { fun testDefaultArgsForOverridden() = runTest {
class Impl : DefaultComposableContent class Impl : DefaultComposableContent
val root = composeText { val root = composeText {
Impl().ComposableContent() Impl().ComposableContent()
} }
@ -101,7 +102,8 @@ class CollectionOfComposablesTests {
val f: List<@Composable () -> Unit>, val f: List<@Composable () -> Unit>,
) )
val composables: List<@Composable () -> Unit> = listOf(@Composable { TextLeafNode("a") }, @Composable { TextLeafNode("b") }) val composables: List<@Composable () -> Unit> =
listOf(@Composable { TextLeafNode("a") }, @Composable { TextLeafNode("b") })
val single = SingleNested(composables) val single = SingleNested(composables)
val singleRoot = composeText { val singleRoot = composeText {
@ -124,6 +126,45 @@ class CollectionOfComposablesTests {
) )
assertEquals(singleRoot.dump(), doubleRoot.dump()) assertEquals(singleRoot.dump(), doubleRoot.dump())
} }
}
interface ViewModel {
@Composable
fun content()
}
class ViewModelA : ViewModel {
@Composable
override fun content() {
TextLeafNode("a")
}
}
fun <T : ViewModel> get(klass: KClass<T>, viewModelBlock: () -> T): T {
if (klass.toString().contains("asdf")) {
throw Exception("AsdfASDFASDF")
}
return viewModelBlock()
}
@Composable
inline fun <reified T : ViewModel> getReified(
noinline viewModelBlock: () -> T
): T = get(T::class, viewModelBlock)
/** Composable functions with `reified` generic types without proper symbol remapping for
* `IrTypeParameterSymbol` (inside 'T::class' / `IrClassReference`)
* https://github.com/JetBrains/compose-multiplatform/issues/3147
*/
@Test
fun testReifiedGenericComposable() = runTest {
val root = composeText {
val vm = getReified { ViewModelA() }
vm.content()
}
assertEquals(
expected = "root:{a}",
actual = root.dump()
)
}
}

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposeCompilerCompatibility.kt

@ -23,7 +23,7 @@ internal object ComposeCompilerCompatibility {
"1.9.20" to "1.5.3", "1.9.20" to "1.5.3",
"1.9.21" to "1.5.4", "1.9.21" to "1.5.4",
"1.9.22" to "1.5.8.1", "1.9.22" to "1.5.8.1",
"1.9.23" to "1.5.10.1", "1.9.23" to "1.5.10.2",
"2.0.0-Beta1" to "1.5.4-dev1-kt2.0.0-Beta1", "2.0.0-Beta1" to "1.5.4-dev1-kt2.0.0-Beta1",
"2.0.0-Beta4" to "1.5.9-kt-2.0.0-Beta4", "2.0.0-Beta4" to "1.5.9-kt-2.0.0-Beta4",
"2.0.0-Beta5" to "1.5.11-kt-2.0.0-Beta5", "2.0.0-Beta5" to "1.5.11-kt-2.0.0-Beta5",

2
gradle-plugins/gradle.properties

@ -10,7 +10,7 @@ dev.junit.parallel=false
# Default version of Compose Libraries used by Gradle plugin # Default version of Compose Libraries used by Gradle plugin
compose.version=1.6.10-dev1590 compose.version=1.6.10-dev1590
# The latest version of Compose Compiler used by Gradle plugin. Used only in tests/CI. # The latest version of Compose Compiler used by Gradle plugin. Used only in tests/CI.
compose.tests.compiler.version=1.5.10.1 compose.tests.compiler.version=1.5.10.2
# The latest version of Kotlin compatible with compose.tests.compiler.version. Used only in tests/CI. # The latest version of Kotlin compatible with compose.tests.compiler.version. Used only in tests/CI.
compose.tests.compiler.compatible.kotlin.version=1.9.23 compose.tests.compiler.compatible.kotlin.version=1.9.23
# The latest version of Kotlin compatible with compose.tests.compiler.version for JS target. Used only on CI. # The latest version of Kotlin compatible with compose.tests.compiler.version for JS target. Used only on CI.

Loading…
Cancel
Save