https://kotlinlang.org logo
#compose
Title
# compose
m

mon

02/09/2020, 1:30 PM
The compiler chokes on when-in expressions.
This works:
Copy code
state.text = when {
  timesClicked == 1 -> "i did it!"
  timesClicked in 2..9 -> "i did it again!"
  timesClicked in 10..20 -> "i have nothing better to do!"
  else -> "you can stop now."
}
This one,
Copy code
state.text = when (timesClicked) {
  1 -> "i did it!"
  in 2..9 -> "i did it again!"
  in 10..20 -> "i have nothing better to do!"
  else -> "you can stop now."
}
kills the compiler with
org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression at (66,17)
m

Mark Murphy

02/09/2020, 1:37 PM
If you can create a small project that reproduces the problem, file a bug report: https://issuetracker.google.com/issues/new?component=612128
m

mon

02/09/2020, 2:17 PM