AJ Alt
04/30/2018, 11:17 PM// works, returns 1
fun foo(): Int {
while (true) return 1
}
//Type mismatch: inferred type is Unit but Int was expected
fun bar(): () -> Int = l@{
while (true) return@l 1
}
// works, returns 1, but results in 'Warning: Unreachable code'
fun baz(): () -> Int = l@{
while (true) return@l 1
2
}
I understand what's happening, but is there a documented reason that bar
wouldn't compile, or should I file an issue?