hfhbd
05/12/2025, 3:06 PMhfhbd
05/12/2025, 3:07 PMfun TestBuilder.scoped() {
scopedCase {
case {
scoped {
action()
}
}
}
}
And I use this existing dsl:
@DslMarker
annotation class TestDsl
@TestDsl
interface TestBuilder {
fun case(action: CaseBuilder.() -> Unit)
}
@TestDsl
interface CaseBuilder {
fun then(action: Then.() -> Unit)
}
@TestDsl
interface Then {
fun action()
}
hfhbd
05/12/2025, 3:08 PMfun TestBuilder.scopedCase(
action: context(String) TestBuilder.() -> Unit
) {
}
context(_: String)
fun CaseBuilder.scoped(thenAction: Then.() -> Unit) {
then {
thenAction()
}
}
hfhbd
05/12/2025, 3:09 PMscopedCase and scoped cannot be called in this context with an implicit receiver
hfhbd
05/12/2025, 3:20 PMYoussef Shoaib [MOD]
05/12/2025, 7:21 PMhfhbd
05/12/2025, 7:27 PM