Skip to content

Commit 41a6d3d

Browse files
Update compose compiler version to 1.5.10.2 (JetBrains#4652)
version bump & test added for reified generic in composable functions Fixes JetBrains#3147
1 parent 2447b07 commit 41a6d3d

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
org.gradle.jvmargs=-Xmx4096M -XX:MaxMetaspaceSize=512m
22
kotlin.code.style=official
33
android.useAndroidX=true
4-
kotlin.version=1.9.22
4+
kotlin.version=1.9.23
55
agp.version=7.3.0
66

77
# a version of compose libraries. In this project the only dependency is compose-runtime.
8-
compose.version=1.6.0-rc03
8+
compose.version=1.6.1
99
# a group id for compose-runtime. Keep it as a parameter to easily change it on CI.
1010
compose.runtime.groupId=org.jetbrains.compose.runtime
1111

1212
kotlinx.coroutines.version=1.8.0
1313

1414
#empty by default - a default version will be used
1515
#compose.kotlinCompilerPluginVersion=23.12.18
16-
compose.kotlinCompilerPluginVersion=1.5.10.1
16+
compose.kotlinCompilerPluginVersion=1.5.10.2
1717

1818
# default|failingJs - see enum class CasesToRun
1919
tests.casesToRun=default

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

+44-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.example.common.TextLeafNode
44
import com.example.common.composeText
55
import kotlinx.coroutines.ExperimentalCoroutinesApi
66
import kotlinx.coroutines.test.runTest
7+
import kotlin.reflect.KClass
78
import kotlin.test.Test
89
import kotlin.test.assertEquals
910

@@ -45,7 +46,7 @@ class CollectionOfComposablesTests {
4546
@Test
4647
fun testDefaultArgsForOverridden() = runTest {
4748
class Impl : DefaultComposableContent
48-
49+
4950
val root = composeText {
5051
Impl().ComposableContent()
5152
}
@@ -101,7 +102,8 @@ class CollectionOfComposablesTests {
101102
val f: List<@Composable () -> Unit>,
102103
)
103104

104-
val composables: List<@Composable () -> Unit> = listOf(@Composable { TextLeafNode("a") }, @Composable { TextLeafNode("b") })
105+
val composables: List<@Composable () -> Unit> =
106+
listOf(@Composable { TextLeafNode("a") }, @Composable { TextLeafNode("b") })
105107
val single = SingleNested(composables)
106108

107109
val singleRoot = composeText {
@@ -124,6 +126,45 @@ class CollectionOfComposablesTests {
124126
)
125127
assertEquals(singleRoot.dump(), doubleRoot.dump())
126128
}
127-
}
128129

130+
interface ViewModel {
131+
@Composable
132+
fun content()
133+
}
134+
135+
class ViewModelA : ViewModel {
136+
@Composable
137+
override fun content() {
138+
TextLeafNode("a")
139+
}
140+
}
141+
142+
fun <T : ViewModel> get(klass: KClass<T>, viewModelBlock: () -> T): T {
143+
if (klass.toString().contains("asdf")) {
144+
throw Exception("AsdfASDFASDF")
145+
}
146+
return viewModelBlock()
147+
}
148+
149+
@Composable
150+
inline fun <reified T : ViewModel> getReified(
151+
noinline viewModelBlock: () -> T
152+
): T = get(T::class, viewModelBlock)
153+
154+
/** Composable functions with `reified` generic types without proper symbol remapping for
155+
* `IrTypeParameterSymbol` (inside 'T::class' / `IrClassReference`)
156+
* https://github.com/JetBrains/compose-multiplatform/issues/3147
157+
*/
158+
@Test
159+
fun testReifiedGenericComposable() = runTest {
160+
val root = composeText {
161+
val vm = getReified { ViewModelA() }
162+
vm.content()
163+
}
129164

165+
assertEquals(
166+
expected = "root:{a}",
167+
actual = root.dump()
168+
)
169+
}
170+
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal object ComposeCompilerCompatibility {
2323
"1.9.20" to "1.5.3",
2424
"1.9.21" to "1.5.4",
2525
"1.9.22" to "1.5.8.1",
26-
"1.9.23" to "1.5.10.1",
26+
"1.9.23" to "1.5.10.2",
2727
"2.0.0-Beta1" to "1.5.4-dev1-kt2.0.0-Beta1",
2828
"2.0.0-Beta4" to "1.5.9-kt-2.0.0-Beta4",
2929
"2.0.0-Beta5" to "1.5.11-kt-2.0.0-Beta5",

gradle-plugins/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dev.junit.parallel=false
1010
# Default version of Compose Libraries used by Gradle plugin
1111
compose.version=1.6.10-dev1590
1212
# The latest version of Compose Compiler used by Gradle plugin. Used only in tests/CI.
13-
compose.tests.compiler.version=1.5.10.1
13+
compose.tests.compiler.version=1.5.10.2
1414
# The latest version of Kotlin compatible with compose.tests.compiler.version. Used only in tests/CI.
1515
compose.tests.compiler.compatible.kotlin.version=1.9.23
1616
# The latest version of Kotlin compatible with compose.tests.compiler.version for JS target. Used only on CI.

0 commit comments

Comments
 (0)