in the meanwhile, if you can supply the type through context, e.g.
Copy code
val sum: Int = sumOf { ... }
that will work
n
nkiesel
08/26/2021, 9:39 PM
thanks for the YouTrack link. However,
val sum: Int = (1..10).sumOf { if (it % 2 == 0) 1 else 0 }
still fails with the same error.
My personal belief is that the decision to support automatic promotions from
Int
literals to
Long
is a design mistake in Kotlin. Kotlin normally (and rightfully so) requires explicit conversions in all other places. So why then should I be allowed to use