[FIR] Extract non-null info from x?.y!! ^KT-44513 Fixed

This commit is contained in:
Ivan Kochurkin
2021-10-04 14:23:08 +03:00
parent 2e1f455d9c
commit 55839aab91
8 changed files with 26 additions and 73 deletions
@@ -1,20 +0,0 @@
//KT-702 Type inference failed
package a
//+JDK
fun <T> getJavaClass() : java.lang.Class<T> { <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
public class Throwables() {
companion object {
public fun <X : Throwable?> propagateIfInstanceOf(throwable : Throwable?, declaredType : Class<X?>?) : Unit {
if (((throwable != null) && declaredType?.isInstance(throwable)!!))
{
throw declaredType?.cast(throwable)!!
}
}
public fun propagateIfPossible(throwable : Throwable?) : Unit {
propagateIfInstanceOf(throwable, getJavaClass<Error?>()) // Type inference failed: Mismatch while expanding constraints
propagateIfInstanceOf(throwable, getJavaClass<RuntimeException?>()) // Type inference failed: Mismatch while expanding constraints
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-702 Type inference failed
package a
//+JDK