Files
kotlin-fork/compiler/testData/ir/interpreter/unitResult.kt
T
Ivan Kylchik cc169613c1 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.
2021-06-07 15:35:20 +03:00

13 lines
870 B
Kotlin
Vendored

@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()<!>