Browse Source
Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>pull/1455/head
Oleksandr Karpovich
3 years ago
committed by
GitHub
10 changed files with 49 additions and 30 deletions
@ -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" } |
||||
} |
@ -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<Int>() |
||||
|
||||
fun main() { |
||||
callComposable { |
||||
Foo<String> { } |
||||
Foo<String> { set.add(1) } |
||||
Foo<String>() |
||||
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<C> |
||||
|
||||
@Composable |
||||
fun <C : Any> Foo(block: @Composable (RouterState<C>) -> Unit = {}) {} |
||||
fun <C : Any> Foo(block: @Composable (RouterState<C>) -> Unit = { set.add(2) }) { |
||||
block(RouterState()) |
||||
} |
||||
|
||||
@Composable |
||||
fun <T> FooTakesTypedComposableLambda2(t: T, composable: @Composable (T) -> T = { t }) { |
||||
fun <T> FooTakesTypedComposableLambda2(t: T, composable: @Composable (T) -> T = { |
||||
set.add(3) |
||||
t |
||||
}) { |
||||
composable(t) |
||||
} |
||||
|
||||
@Composable |
||||
fun <T> FooTakesTypedComposableLambda3(t: T, composable: @Composable () -> T = { t }) { |
||||
fun <T> FooTakesTypedComposableLambda3(t: T, composable: @Composable () -> T = { |
||||
set.add(4) |
||||
t |
||||
}) { |
||||
composable() |
||||
} |
@ -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 |
||||
|
Loading…
Reference in new issue