mirror of
https://github.com/jlengrand/compose-multiplatform.git
synced 2026-05-16 08:11:20 +00:00
* web: Add integration cases for compose plugin targeting kotlin/js * web: Add integration cases for compose plugin targeting kotlin/js * Report cases to TeamCity * Update README.md Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
46 lines
1.1 KiB
Kotlin
46 lines
1.1 KiB
Kotlin
// @Module:Main
|
|
|
|
// https://youtrack.jetbrains.com/issue/KT-46880
|
|
import androidx.compose.runtime.Composable
|
|
|
|
fun main() {
|
|
val instance = testCase { }
|
|
val instance2 = TestCase2()
|
|
|
|
callComposable {
|
|
instance.composable()
|
|
instance2.composable()
|
|
}
|
|
}
|
|
|
|
fun callComposable(content: @Composable () -> Unit) {
|
|
// does nothing
|
|
}
|
|
|
|
// @Module:Lib
|
|
import androidx.compose.runtime.Composable
|
|
import kotlin.properties.ReadOnlyProperty
|
|
import kotlin.reflect.KProperty
|
|
|
|
class TestCase(val composable: @Composable () -> Unit) {
|
|
operator fun provideDelegate(
|
|
thisRef: Any,
|
|
property: KProperty<*>
|
|
): ReadOnlyProperty<Any?, String> {
|
|
return ReadOnlyProperty { _, _ -> property.name }
|
|
}
|
|
}
|
|
|
|
class TestCase2(val composable: @Composable () -> Unit = {}) {
|
|
operator fun provideDelegate(
|
|
thisRef: Any,
|
|
property: KProperty<*>
|
|
): ReadOnlyProperty<Any?, String> {
|
|
return ReadOnlyProperty { _, _ -> property.name }
|
|
}
|
|
}
|
|
|
|
fun testCase(composable: @Composable () -> Unit): TestCase {
|
|
return TestCase(composable)
|
|
}
|