KT-57491 Prefix context receivers with $context_receiver_
This commit is contained in:
committed by
Space Team
parent
f3592088fe
commit
0e6da53af8
+5
-5
@@ -43,20 +43,20 @@ object StringMonoid : Monoid<String> {
|
||||
|
||||
}
|
||||
|
||||
fun <T : Any?> List<T>.sum(_context_receiver_0: Monoid<T>): T {
|
||||
return <this>.fold<T, T>(initial = _context_receiver_0.<get-unit>(), operation = local fun <anonymous>(acc: T, e: T): T {
|
||||
return (_context_receiver_0, acc).combine(other = e)
|
||||
fun <T : Any?> List<T>.sum($context_receiver_0: Monoid<T>): T {
|
||||
return <this>.fold<T, T>(initial = $context_receiver_0.<get-unit>(), operation = local fun <anonymous>(acc: T, e: T): T {
|
||||
return ($context_receiver_0, acc).combine(other = e)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
with<IntMonoid, Int>(receiver = IntMonoid, block = local fun IntMonoid.<anonymous>(): Int {
|
||||
return listOf<Int>(elements = [1, 2, 3]).sum<Int>(_context_receiver_0 = $this$with)
|
||||
return listOf<Int>(elements = [1, 2, 3]).sum<Int>($context_receiver_0 = $this$with)
|
||||
}
|
||||
) /*~> Unit */
|
||||
return with<StringMonoid, String>(receiver = StringMonoid, block = local fun StringMonoid.<anonymous>(): String {
|
||||
return listOf<String>(elements = ["O", "K"]).sum<String>(_context_receiver_0 = $this$with)
|
||||
return listOf<String>(elements = ["O", "K"]).sum<String>($context_receiver_0 = $this$with)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user