PSI2IR: do not generate when subjects multiple times

`in x` is represented as `<subject expression> in x` in psi, so
generating the entire call and then replacing the argument with a read
of a temporary results in redundant regenerations of the subject.

 #KT-42054 Fixed
 #KT-42455 Fixed
This commit is contained in:
pyos
2020-10-07 12:46:07 +02:00
committed by Dmitry Petrov
parent e280416fe2
commit 98088f739d
10 changed files with 63 additions and 17 deletions
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
fun box(): String {
val xs = listOf(1, 2, 3)
return when (xs.first { it > 1 }) {
in xs -> "OK"
else -> "fail"
}
}