David Kubecka
11/20/2024, 3:35 PMfun withTestContext(block: context(Context1, Context2) () -> Unit) =
block(TEST_CONTEXT_1, TEST_CONTEXT_2)
context(Context1, Context2)
fun myFun() {}
fun myTest() = withTestContext {
myFun(..., ...) // how to access the corresponding contexts here?
}
Youssef Shoaib [MOD]
11/20/2024, 5:19 PMcontext(A) fun <A> given(): A = this@A
David Kubecka
11/20/2024, 5:27 PMmyFun(given<Context1>(), given<Context2>())
I hope this will be improved in the next iterations of context parameters.David Kubecka
11/20/2024, 5:28 PMephemient
11/21/2024, 2:06 AMthis@Context1
, this@Context2
not work?ephemient
11/21/2024, 2:07 AMDavid Kubecka
11/21/2024, 8:12 AMdoesNo, but that's probably what I would expect.,this@Context1
not workthis@Context2