Luis
12/13/2017, 9:34 PMfun <A, B, R> Pair<A, B>.foo(block: (A, B) -> R): R = block(first, second)
Pair(1, 2).foo { a, b -> println("a: $a, b: $b") } // Compiler complains that type inference failed for R
EDIT: This example actually works for my in the REPL, although I have a more complex example for which this doesn't work (the val _: Unit trick below fixes the problem though), a more basic example is select which requires the explicit <Unit> type if used like a statement. That case is not problematic though since there's a single type argument.