Bernhard
10/06/2026, 2:02 PMBernhard
10/06/2026, 2:03 PMval ctx = Context()
val root = RecordProperty("", Props())
val result = context(ctx) {
root {
test.set("value")
nested {
-inner
}
}
}
but when I move that thing into a function like this:
fun <T> buildUpdate(properties: T, action: TypeSafeUpdateTest.Props.() -> Unit): Record<String, Any?> {
val ctx = Context()
val p = Props()
val root = RecordProperty("", p)
context(ctx) {
root {
p.action()
}
}
return ctx.updates
}
I'm getting this kind of errorBernhard
10/06/2026, 2:05 PMcontext(ctx: Context)
operator fun invoke(value: T.() -> Unit) {
context(ctx.path(path)) {
properties.value()
}
}Youssef Shoaib [MOD]
10/06/2026, 2:10 PMfun <T> buildUpdate(properties: T, action: context(Context) TypeSafeUpdateTest.Props.() -> Unit): Record<String, Any?> {
val ctx = Context()
val p = Props()
val root = RecordProperty("", p)
context(ctx) {
root {
p.action()
}
}
return ctx.updates
}Bernhard
10/06/2026, 2:10 PMBernhard
10/06/2026, 2:11 PMYoussef Shoaib [MOD]
10/06/2026, 2:12 PMBernhard
10/06/2026, 2:14 PMYoussef Shoaib [MOD]
10/06/2026, 2:15 PM