[FIR] Add regression test for KT-44392

Also related to KT-56615
This commit is contained in:
Dmitriy Novozhilov
2023-02-13 12:45:58 +02:00
committed by Space Team
parent 197f19c627
commit 019d7db737
6 changed files with 86 additions and 0 deletions
@@ -0,0 +1,9 @@
FILE: redundantNullCheckOnAsCast.kt
public final fun test_1(a: R|kotlin/Any?|): R|kotlin/Unit| {
(R|<local>/a| as R|kotlin/String?|)!!
(R|<local>/a| as? R|kotlin/String|)!!
}
public final fun test_2(a: R|kotlin/Any?|): R|kotlin/Unit| {
(R|<local>/a| as R|kotlin/String?|)!!
R|<local>/a|!!
}
@@ -0,0 +1,11 @@
// ISSUE: KT-44392, KT-56615
fun test_1(a: Any?) {
(a as String?)!!
(a as? String)!!
}
fun test_2(a: Any?) {
(a as String?)!!
a<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
}