Michael de Kaste
04/13/2020, 11:17 AMtypealias 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:
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?Kroppeb
04/13/2020, 1:20 PM:Int
the the first a1
makes the second one also an Int
but not the other way aroundAlexey Belkov [JB]
04/14/2020, 12:09 PMMichael de Kaste
04/14/2020, 12:28 PM