Fixed bug in DFGBuilder + test

This commit is contained in:
Igor Chevdar
2018-03-23 14:16:12 +03:00
parent 183bf917ee
commit 4ae458abfd
3 changed files with 29 additions and 1 deletions
@@ -139,7 +139,12 @@ private class ExpressionValuesExtractor(val context: Context,
is IrContainerExpression -> {
if (expression.statements.isNotEmpty())
forEachValue(expression.statements.last() as IrExpression, block)
forEachValue(
expression = (expression.statements.last() as? IrExpression)
?: IrGetObjectValueImpl(expression.startOffset, expression.endOffset,
context.builtIns.unitType, context.ir.symbols.unit),
block = block
)
}
is IrWhen -> expression.branches.forEach { forEachValue(it.result, block) }
+5
View File
@@ -2266,6 +2266,11 @@ task inline_getClass(type: RunKonanTest) {
source = "codegen/inline/getClass.kt"
}
task inline_statementAsLastExprInBlock(type: RunKonanTest) {
goldValue = "OK\n"
source = "codegen/inline/statementAsLastExprInBlock.kt"
}
task deserialized_inline0(type: RunKonanTest) {
source = "serialization/deserialized_inline0.kt"
}
@@ -0,0 +1,18 @@
package codegen.inline.statementAsLastExprInBlock
import kotlin.test.*
fun foo() {
val cls1: Any? = Int
val cls2: Any? = null
cls1?.let {
if (cls2 != null) {
val zzz = 42
}
}
}
@Test fun runTest() {
println("OK")
}