diff --git a/web/compose-compiler-integration/testcases/failing/CompanionGetValueOperatorComposable.kt b/web/compose-compiler-integration/testcases/failing/CompanionGetValueOperatorComposable.kt index f5a0dd9917..513c251289 100644 --- a/web/compose-compiler-integration/testcases/failing/CompanionGetValueOperatorComposable.kt +++ b/web/compose-compiler-integration/testcases/failing/CompanionGetValueOperatorComposable.kt @@ -19,7 +19,3 @@ fun main() { val router by Router } } - -fun callComposable(content: @Composable () -> Unit) { - // does nothing -} diff --git a/web/compose-compiler-integration/testcases/failing/ComposableWithNullableTypeParameter.kt b/web/compose-compiler-integration/testcases/failing/ComposableWithNullableTypeParameter.kt index 636e2ebc2c..1eb0a9cb91 100644 --- a/web/compose-compiler-integration/testcases/failing/ComposableWithNullableTypeParameter.kt +++ b/web/compose-compiler-integration/testcases/failing/ComposableWithNullableTypeParameter.kt @@ -2,6 +2,7 @@ // https://github.com/JetBrains/compose-jb/issues/1226 +// TODO: move this to passing cases after kotlin 1.6.0 import kotlin.reflect.KProperty import androidx.compose.runtime.Composable @@ -21,7 +22,3 @@ fun main() { ) } } - -fun callComposable(content: @Composable () -> Unit) { - // does nothing -} diff --git a/web/compose-compiler-integration/testcases/failing/InstanceGetValueOperatorComposable.kt b/web/compose-compiler-integration/testcases/failing/InstanceGetValueOperatorComposable.kt index 9f2e6d36ec..61823fd8cc 100644 --- a/web/compose-compiler-integration/testcases/failing/InstanceGetValueOperatorComposable.kt +++ b/web/compose-compiler-integration/testcases/failing/InstanceGetValueOperatorComposable.kt @@ -17,7 +17,3 @@ fun main() { val router by Router() } } - -fun callComposable(content: @Composable () -> Unit) { - // does nothing -} diff --git a/web/compose-compiler-integration/testcases/failing/MutableStateDestructuringDeclarartion.kt b/web/compose-compiler-integration/testcases/failing/MutableStateDestructuringDeclarartion.kt new file mode 100644 index 0000000000..33e569951a --- /dev/null +++ b/web/compose-compiler-integration/testcases/failing/MutableStateDestructuringDeclarartion.kt @@ -0,0 +1,14 @@ +// @Module:Main + +// https://github.com/JetBrains/compose-jb/issues/1436 + +import kotlin.reflect.KProperty +import androidx.compose.runtime.* + + +fun main() { + var (foo, setFoo) = mutableStateOf(0) + setFoo(123) // set + require(foo == 0) { "If this failed, it probably means the issue was fixed" } + require(foo == 123) { "Expected Failure (wrong behaviour)! foo was expected to get updated, but it's acutal value is $foo" } +} diff --git a/web/compose-compiler-integration/testcases/passing/ComposableWithParamsWithDefaultValues.kt b/web/compose-compiler-integration/testcases/passing/ComposableWithParamsWithDefaultValues.kt index 857795b460..2a385ecce7 100644 --- a/web/compose-compiler-integration/testcases/passing/ComposableWithParamsWithDefaultValues.kt +++ b/web/compose-compiler-integration/testcases/passing/ComposableWithParamsWithDefaultValues.kt @@ -15,7 +15,7 @@ fun main() { ComposableWithDifferentDefaultValuesForParameters(a = Any()) ComposableWithReturnAndWithDefaultLambda().invoke() } - require(intArrayOf(1, 2, 3, 4, 5, 6, 7).all { it in set }) { "Failed when running composables - ${set.joinToString()}" } + require(setOf(1, 2, 3, 4, 5, 6, 7) == set) { "Failed when running composables - ${set.joinToString()}" } } // @Module:Lib diff --git a/web/compose-compiler-integration/testcases/passing/ComposableWithTypeParams.kt b/web/compose-compiler-integration/testcases/passing/ComposableWithTypeParams.kt index 4b3c3ddc22..8f9f231018 100644 --- a/web/compose-compiler-integration/testcases/passing/ComposableWithTypeParams.kt +++ b/web/compose-compiler-integration/testcases/passing/ComposableWithTypeParams.kt @@ -20,7 +20,7 @@ fun main() { } } - require(intArrayOf(1, 2, 3, 4).all { it in set }) { "Failed when running composables" } + require(setOf(1, 2, 3, 4) == set) { "Failed when running composables" } } diff --git a/web/compose-compiler-integration/testcases/failing/ComposableWithTypedDefaultValues.kt b/web/compose-compiler-integration/testcases/passing/ComposableWithTypedDefaultValues.kt similarity index 74% rename from web/compose-compiler-integration/testcases/failing/ComposableWithTypedDefaultValues.kt rename to web/compose-compiler-integration/testcases/passing/ComposableWithTypedDefaultValues.kt index add9607799..2640e2d3d5 100644 --- a/web/compose-compiler-integration/testcases/failing/ComposableWithTypedDefaultValues.kt +++ b/web/compose-compiler-integration/testcases/passing/ComposableWithTypedDefaultValues.kt @@ -1,16 +1,21 @@ // @Module:Main +// fixed in https://github.com/JetBrains/androidx/pull/118 + import androidx.compose.runtime.Composable import androidx.compose.runtime.currentComposer import androidx.compose.runtime.Composer fun main() { + var called = false + callComposable { - ComposableWithTypedDefaultValue({}) + ComposableWithTypedDefaultValue({ it -> + check(it.value == null) + called = true + }) } -} -fun callComposable(content: @Composable () -> Unit) { - val c = content + require(called) { "Failed when running composables" } } // @Module:Lib @@ -39,5 +44,7 @@ class NullWrapper : NullableWrapper() { fun ComposableWithTypedDefaultValue( onChange: (NullableWrapper) -> Unit, valueWrapper: NullableWrapper = NullWrapper() -) {} +) { + onChange(valueWrapper) +} diff --git a/web/compose-compiler-integration/testcases/passing/PassingComposableToConstructor.kt b/web/compose-compiler-integration/testcases/passing/PassingComposableToConstructor.kt index 6366421167..db7b9effca 100644 --- a/web/compose-compiler-integration/testcases/passing/PassingComposableToConstructor.kt +++ b/web/compose-compiler-integration/testcases/passing/PassingComposableToConstructor.kt @@ -16,7 +16,7 @@ fun main() { instance2.composable() set.add(2) } - require(intArrayOf(1, 2).all { it in set }) { "Failed when running composables" } + require(setOf(1, 2) == set) { "Failed when running composables" } } // @Module:Lib diff --git a/web/compose-compiler-integration/testcases/failing/WithComposableBlockUsingTypeParameterAndDefaultValue.kt b/web/compose-compiler-integration/testcases/passing/WithComposableBlockUsingTypeParameterAndDefaultValue.kt similarity index 57% rename from web/compose-compiler-integration/testcases/failing/WithComposableBlockUsingTypeParameterAndDefaultValue.kt rename to web/compose-compiler-integration/testcases/passing/WithComposableBlockUsingTypeParameterAndDefaultValue.kt index 8a17d35e11..b8cf487b40 100644 --- a/web/compose-compiler-integration/testcases/failing/WithComposableBlockUsingTypeParameterAndDefaultValue.kt +++ b/web/compose-compiler-integration/testcases/passing/WithComposableBlockUsingTypeParameterAndDefaultValue.kt @@ -1,30 +1,39 @@ // https://github.com/JetBrains/compose-jb/issues/774 +// fixed in https://github.com/JetBrains/androidx/pull/118 import androidx.compose.runtime.Composable +val set = mutableSetOf() + fun main() { callComposable { - Foo { } + Foo { set.add(1) } + Foo() FooTakesTypedComposableLambda2("T") FooTakesTypedComposableLambda3("T") } -} - -fun callComposable(content: @Composable () -> Unit) { - // does nothing + require(setOf(1,2,3,4) == set) { "Failed when running composable. Actual result - ${set.joinToString()}" } } class RouterState @Composable -fun Foo(block: @Composable (RouterState) -> Unit = {}) {} +fun Foo(block: @Composable (RouterState) -> Unit = { set.add(2) }) { + block(RouterState()) +} @Composable -fun FooTakesTypedComposableLambda2(t: T, composable: @Composable (T) -> T = { t }) { +fun FooTakesTypedComposableLambda2(t: T, composable: @Composable (T) -> T = { + set.add(3) + t +}) { composable(t) } @Composable -fun FooTakesTypedComposableLambda3(t: T, composable: @Composable () -> T = { t }) { +fun FooTakesTypedComposableLambda3(t: T, composable: @Composable () -> T = { + set.add(4) + t +}) { composable() } diff --git a/web/gradle.properties b/web/gradle.properties index 5e1bd63e60..bce65603b7 100644 --- a/web/gradle.properties +++ b/web/gradle.properties @@ -1,6 +1,6 @@ # __LATEST_COMPOSE_RELEASE_VERSION__ -COMPOSE_CORE_VERSION=1.0.0-rc2 -COMPOSE_WEB_VERSION=1.0.0-alpha4-build362 +COMPOSE_CORE_VERSION=1.0.0-rc3 +COMPOSE_WEB_VERSION=1.0.0-rc3 compose.web.buildSamples=false compose.web.tests.integration.withFirefox compose.web.tests.skip.benchmarks=false