Michael de Kaste

04/13/2020, 11:17 AM
Did I encounter a bug? consider the following code:
Copy code
typealias Point = Pair<Int, Int>
val (axis1, axis2, pointConstruct) = when(horizontal){
    true -> Triple(0..height, 0..width, {a1, a2 -> Point(a1, a2)})
    false -> Triple(0..width, 0..height, {a1, a2 -> Point(a2, a1)})
Instead of telling me:
Type cannot be infered
on a1,a2 in any of both lambdas, it simply states that Point is unreachable code. Alongside; it states that pointConstruct is a
(Nothing, Nothing) -> Point
function simply declaring:
Copy code
val pointConstruct = {a1, a2 -> Point(a1, a2)}
will correctly tell me that a1 and a2 cannot be infered. Why does it infer a
(Nothing, Nothing) -> Point
in the deconstructed lamba, but a compile error on the single line one?


04/13/2020, 1:20 PM
Seems like a bug to me. Very weird indeed. Adding
the the first
makes the second one also an
but not the other way around

Alexey Belkov [JB]

04/14/2020, 12:09 PM
Can you please file an issue on with a self-contained code sample to reproduce? Thanks!

Michael de Kaste

04/14/2020, 12:28 PM
I just did. Visible here: 🙂
🙏 1