diff --git a/web/compose-compiler-integration/testcases/failing/ComposableWithTypedDefaultValues.kt b/web/compose-compiler-integration/testcases/failing/ComposableWithTypedDefaultValues.kt new file mode 100644 index 0000000000..add9607799 --- /dev/null +++ b/web/compose-compiler-integration/testcases/failing/ComposableWithTypedDefaultValues.kt @@ -0,0 +1,43 @@ +// @Module:Main +import androidx.compose.runtime.Composable +import androidx.compose.runtime.currentComposer +import androidx.compose.runtime.Composer + +fun main() { + callComposable { + ComposableWithTypedDefaultValue({}) + } +} + +fun callComposable(content: @Composable () -> Unit) { + val c = content +} + +// @Module:Lib +import androidx.compose.runtime.Composable + +sealed class NullableWrapper { + companion object { + fun of(value: T?): NullableWrapper = + if (value != null) { + NonNullWrapper(value) + } else { + NullWrapper() + } + } + + abstract val value: T? +} + +class NonNullWrapper(override val value: T) : NullableWrapper() + +class NullWrapper : NullableWrapper() { + override val value: T? get() = null +} + +@Composable // https://github.com/JetBrains/compose-jb/issues/1226 +fun ComposableWithTypedDefaultValue( + onChange: (NullableWrapper) -> Unit, + valueWrapper: NullableWrapper = NullWrapper() +) {} +