[FIR] Add nullability to ILT. #KT-37639 Fixed

This commit is contained in:
Dmitriy Novozhilov
2020-03-20 15:32:33 +03:00
parent 006e1f6528
commit 6ce8d661ad
11 changed files with 89 additions and 23 deletions
@@ -0,0 +1,13 @@
// ISSUE: KT-37639
fun takeInt(x: Int) {}
fun test_1(b: Boolean) {
val x = if (b) 1 else null
<!INAPPLICABLE_CANDIDATE!>takeInt<!>(x)
}
fun test_2(b: Boolean, y: Int) {
val x = if (b) y else null
<!INAPPLICABLE_CANDIDATE!>takeInt<!>(x)
}
@@ -0,0 +1,27 @@
FILE: nullableIntegerLiteralType.kt
public final fun takeInt(x: R|kotlin/Int|): R|kotlin/Unit| {
}
public final fun test_1(b: R|kotlin/Boolean|): R|kotlin/Unit| {
lval x: R|kotlin/Int?| = when () {
R|<local>/b| -> {
Int(1)
}
else -> {
Null(null)
}
}
<Inapplicable(INAPPLICABLE): [/takeInt]>#(R|<local>/x|)
}
public final fun test_2(b: R|kotlin/Boolean|, y: R|kotlin/Int|): R|kotlin/Unit| {
lval x: R|kotlin/Int?| = when () {
R|<local>/b| -> {
R|<local>/y|
}
else -> {
Null(null)
}
}
<Inapplicable(INAPPLICABLE): [/takeInt]>#(R|<local>/x|)
}