FIR: Fix inference when unit value should be cast to Any

This commit is contained in:
Denis.Zharkov
2021-04-30 14:14:13 +03:00
committed by teamcityserver
parent d3fc22fc6a
commit c3646b11ac
6 changed files with 45 additions and 3 deletions
@@ -0,0 +1,15 @@
FILE: unitUpperBound.kt
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun foo(x: R|kotlin/collections/List<kotlin/String>|): R|kotlin/Unit| {
lvar w: R|kotlin/Int| = Int(1)
R|<local>/x|.R|kotlin/collections/ifEmpty|<R|kotlin/collections/List<kotlin/String>|, R|kotlin/Any|>(<L> = ifEmpty@fun <anonymous>(): R|kotlin/Any| <inline=Inline, kind=UNKNOWN> {
R|<local>/w| = R|<local>/w|.R|kotlin/Int.plus|(Int(2))
}
)
}
}
@@ -0,0 +1,11 @@
// WITH_STDLIB
// FULL_JDK
class A {
fun foo(x: List<String>) {
var w = 1
x.ifEmpty {
w += 2
}
}
}