Browse Source

web: add compiler test case for type nullable params (#1227)

Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
pull/1229/head
Oleksandr Karpovich 3 years ago committed by GitHub
parent
commit
326a130ab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      web/compose-compiler-integration/testcases/failing/ComposableWithNullableTypeParameter.kt
  2. 8
      web/compose-compiler-integration/testcases/passing/ComposableWithTypeParams.kt

27
web/compose-compiler-integration/testcases/failing/ComposableWithNullableTypeParameter.kt

@ -0,0 +1,27 @@
// @Module:Main
// https://github.com/JetBrains/compose-jb/issues/1226
import kotlin.reflect.KProperty
import androidx.compose.runtime.Composable
@Composable
fun <T> MySelect(
options: List<T>,
onChange: (T?) -> Unit
) {
}
fun main() {
callComposable {
MySelect<String>(
options = emptyList(),
onChange = {}
)
}
}
fun callComposable(content: @Composable () -> Unit) {
// does nothing
}

8
web/compose-compiler-integration/testcases/passing/ComposableWithTypeParams.kt

@ -9,6 +9,7 @@ fun main() {
FooTakesTypedComposableLambda { "text" }
FooTakesTypedComposableLambda2(10) { it + 100 }
FooTakesTypedExtesionComposableLambda<String, Any, Unit>("text", Any()) { }
MySelect<String>(emptyList(), {})
}
}
@ -34,3 +35,10 @@ fun <T> FooTakesTypedComposableLambda2(t: T, composable: @Composable (T) -> T) {
fun <T, K, R> FooTakesTypedExtesionComposableLambda(t: T, k: K, composable: @Composable T.(K) -> R) {
t.composable(k)
}
@Composable
fun <T> MySelect(
options: List<T>,
onChange: (T) -> Unit
) {
}

Loading…
Cancel
Save