Is this a bug about type inference?

val shouldBeInt = run {
    var i = 1
    while(true) {
        if (i > 10) return@run i

In above code piece, sholeBeInt would be Any type instead of Int

Return an int after the while loop and it will work as expected.

There is an implicit return of Unit.