[FIR2IR] Add Unit coercion for non-last expressions in try/catch blocks
^KT-61088 Fixed
This commit is contained in:
committed by
Space Team
parent
3d66511ca7
commit
88b80e0ed2
@@ -18,13 +18,19 @@ FILE fqName:<root> fileName:/tryCatch.kt
|
||||
TRY type=kotlin.Int
|
||||
try: BLOCK type=kotlin.Int origin=null
|
||||
CALL 'public final fun println (): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CONST Int type=kotlin.Int value=100
|
||||
CONST Int type=kotlin.Int value=42
|
||||
CATCH parameter=val e: kotlin.Throwable declared in <root>.test2
|
||||
VAR CATCH_PARAMETER name:e type:kotlin.Throwable [val]
|
||||
BLOCK type=kotlin.Int origin=null
|
||||
CALL 'public final fun println (): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CONST Int type=kotlin.Int value=101
|
||||
CONST Int type=kotlin.Int value=24
|
||||
finally: BLOCK type=kotlin.Unit origin=null
|
||||
CALL 'public final fun println (): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CONST Int type=kotlin.Int value=102
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CONST Int type=kotlin.Int value=555
|
||||
|
||||
@@ -17,14 +17,17 @@ fun test1() {
|
||||
fun test2(): Int {
|
||||
return try {
|
||||
println()
|
||||
100
|
||||
42
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
println()
|
||||
101
|
||||
24
|
||||
}
|
||||
finally {
|
||||
println()
|
||||
102
|
||||
555
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,17 @@ fun test1() {
|
||||
fun test2(): Int {
|
||||
return try { // BLOCK
|
||||
println()
|
||||
100 /*~> Unit */
|
||||
42
|
||||
}
|
||||
catch (e: Throwable){ // BLOCK
|
||||
println()
|
||||
101 /*~> Unit */
|
||||
24
|
||||
}
|
||||
finally { // BLOCK
|
||||
println()
|
||||
102 /*~> Unit */
|
||||
555 /*~> Unit */
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user