Drop result of finally block after interpretation

This change is needed due to using FIR as frontend for tests. In this
case finally block doesn't has coercion to unit so it's result must
be dropped manually.
This commit is contained in:
Ivan Kylchik
2021-05-24 21:03:05 +03:00
committed by TeamCityServer
parent 61d65436f4
commit cc169613c1
6 changed files with 67 additions and 25 deletions
+12
View File
@@ -0,0 +1,12 @@
@CompileTimeCalculation fun getUnitImplicit(): Unit {}
@CompileTimeCalculation fun getUnitExplicit(): Unit { return Unit }
@CompileTimeCalculation fun getUnitImplicitFromExpression(): Unit { if (true) {} else Unit }
@CompileTimeCalculation fun getUnitImplicitFromTry1(): Unit { try {} finally { 5 } }
@CompileTimeCalculation fun getUnitImplicitFromTry2(): Unit { try {} finally { } }
const val unit1 = Unit.<!EVALUATED: `kotlin.Unit`!>toString()<!>
const val unit2 = getUnitImplicit().<!EVALUATED: `kotlin.Unit`!>toString()<!>
const val unit3 = getUnitExplicit().<!EVALUATED: `kotlin.Unit`!>toString()<!>
const val unit4 = getUnitImplicitFromExpression().<!EVALUATED: `kotlin.Unit`!>toString()<!>
const val unit5 = getUnitImplicitFromTry1().<!EVALUATED: `kotlin.Unit`!>toString()<!>
const val unit6 = getUnitImplicitFromTry2().<!EVALUATED: `kotlin.Unit`!>toString()<!>