FIR2IR: don't generate unnecessary 'return throw'

#KT-60245 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-08-18 17:16:46 +02:00
committed by Space Team
parent 90904e4f8a
commit 7d5e2f85cc
8 changed files with 15 additions and 16 deletions
+2 -3
View File
@@ -2,9 +2,8 @@ FILE fqName:<root> fileName:/kt30796.kt
FUN name:magic visibility:public modality:FINAL <T> () returnType:T of <root>.magic
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun magic <T> (): T of <root>.magic declared in <root>'
THROW type=kotlin.Nothing
CONSTRUCTOR_CALL 'public constructor <init> () declared in java.lang.Exception' type=java.lang.Exception origin=null
THROW type=kotlin.Nothing
CONSTRUCTOR_CALL 'public constructor <init> () declared in java.lang.Exception' type=java.lang.Exception origin=null
FUN name:test visibility:public modality:FINAL <T> (value:T of <root>.test, value2:T of <root>.test) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
VALUE_PARAMETER name:value index:0 type:T of <root>.test
+1 -1
View File
@@ -1,5 +1,5 @@
fun <T : Any?> magic(): T {
return throw Exception()
throw Exception()
}
fun <T : Any?> test(value: T, value2: T) {