From 6b5f5c9ff02d642f3cb10ecb244a2c5f3fe81ff5 Mon Sep 17 00:00:00 2001 From: Youssef Shoaib Date: Fri, 15 Nov 2024 19:05:24 +0000 Subject: [PATCH] Remove suppression from higher-arity zipOrAccumulate --- .../arrow/core/raise/RaiseAccumulate.kt | 606 ++++++++++++------ 1 file changed, 407 insertions(+), 199 deletions(-) diff --git a/arrow-libs/core/arrow-core-high-arity/src/commonMain/kotlin/arrow/core/raise/RaiseAccumulate.kt b/arrow-libs/core/arrow-core-high-arity/src/commonMain/kotlin/arrow/core/raise/RaiseAccumulate.kt index 08251c8a11..d214556be0 100644 --- a/arrow-libs/core/arrow-core-high-arity/src/commonMain/kotlin/arrow/core/raise/RaiseAccumulate.kt +++ b/arrow-libs/core/arrow-core-high-arity/src/commonMain/kotlin/arrow/core/raise/RaiseAccumulate.kt @@ -1,7 +1,6 @@ @file:OptIn(ExperimentalTypeInference::class, ExperimentalContracts::class, ExperimentalRaiseAccumulateApi::class) @file:JvmMultifileClass @file:JvmName("RaiseHighArityKt") -@file:Suppress("LEAKED_IN_PLACE_LAMBDA", "WRONG_INVOCATION_KIND") package arrow.core.raise @@ -40,19 +39,33 @@ public inline fun Raise } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) } @RaiseDSL @@ -84,20 +97,35 @@ public inline fun Raise callsInPlace(action11, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - return accumulate { - val a = accumulating(action1) - val b = accumulating(action2) - val c = accumulating(action3) - val d = accumulating(action4) - val e = accumulating(action5) - val f = accumulating(action6) - val g = accumulating(action7) - val h = accumulating(action8) - val i = accumulating(action9) - val j = accumulating(action10) - val k = accumulating(action11) - block(a.value, b.value, c.value, d.value, e.value, f.value, g.value, h.value, i.value, j.value, k.value) - } + val a1: T1 + val a2: T2 + val a3: T3 + val a4: T4 + val a5: T5 + val a6: T6 + val a7: T7 + val a8: T8 + val a9: T9 + val a10: T10 + val a11: T11 + zipOrAccumulate( + { a1 = action1(this) }, + { a2 = action2(this) }, + { a3 = action3(this) }, + { a4 = action4(this) }, + { a5 = action5(this) }, + { a6 = action6(this) }, + { a7 = action7(this) }, + { a8 = action8(this) }, + { + zipOrAccumulate( + { a9 = action9(this) }, + { a10 = action10(this) }, + { a11 = action11(this) }, + ) { _, _, _ -> } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) } @RaiseDSL @@ -131,21 +159,37 @@ public inline fun callsInPlace(action12, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE) } - return accumulate { - val a = accumulating(action1) - val b = accumulating(action2) - val c = accumulating(action3) - val d = accumulating(action4) - val e = accumulating(action5) - val f = accumulating(action6) - val g = accumulating(action7) - val h = accumulating(action8) - val i = accumulating(action9) - val j = accumulating(action10) - val k = accumulating(action11) - val l = accumulating(action12) - block(a.value, b.value, c.value, d.value, e.value, f.value, g.value, h.value, i.value, j.value, k.value, l.value) - } + val a1: T1 + val a2: T2 + val a3: T3 + val a4: T4 + val a5: T5 + val a6: T6 + val a7: T7 + val a8: T8 + val a9: T9 + val a10: T10 + val a11: T11 + val a12: T12 + zipOrAccumulate( + { a1 = action1(this) }, + { a2 = action2(this) }, + { a3 = action3(this) }, + { a4 = action4(this) }, + { a5 = action5(this) }, + { a6 = action6(this) }, + { a7 = action7(this) }, + { a8 = action8(this) }, + { + zipOrAccumulate( + { a9 = action9(this) }, + { a10 = action10(this) }, + { a11 = action11(this) }, + { a12 = action12(this) }, + ) { _, _, _, _ -> } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) } @RaiseDSL @@ -181,22 +225,39 @@ public inline fun } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) } @RaiseDSL @@ -234,23 +295,41 @@ public inline fun } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) } @RaiseDSL @@ -290,24 +369,43 @@ public inline fun } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) } @RaiseDSL @@ -349,25 +447,45 @@ public inline fun } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) } @RaiseDSL @@ -411,26 +529,47 @@ public inline fun } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) } @RaiseDSL @@ -476,27 +615,49 @@ public inline fun } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) } @RaiseDSL @@ -544,28 +705,51 @@ public inline fun } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) } @RaiseDSL @@ -615,28 +799,52 @@ public inline fun } + } + ) { _, _, _, _, _, _, _, _, _ -> } + return block(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) }