Philipp Mayer
10/06/2020, 7:24 PMreturn when ((1..2).random()) {
1 -> "ABC"
2 -> "XYZ"
else -> "???"
}
The range only includes 1 and 2 and random returns an int.. 🤔diesieben07
10/06/2020, 7:26 PMrandom() returns an Int, as such as far as the compiler is concerned it could be any Int.
Even more, 1..2 is just an Int range, it has no information about the size of that range.jw
10/06/2020, 7:29 PMreturn when(1) { 1 -> "" } as well for a more illustrative example. type ranges are not currently refined given compile-time information.Ruckus
10/06/2020, 7:34 PM