Fixed bug in DFGBuilder + test
This commit is contained in:
+6
-1
@@ -139,7 +139,12 @@ private class ExpressionValuesExtractor(val context: Context,
|
|||||||
|
|
||||||
is IrContainerExpression -> {
|
is IrContainerExpression -> {
|
||||||
if (expression.statements.isNotEmpty())
|
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) }
|
is IrWhen -> expression.branches.forEach { forEachValue(it.result, block) }
|
||||||
|
|||||||
@@ -2266,6 +2266,11 @@ task inline_getClass(type: RunKonanTest) {
|
|||||||
source = "codegen/inline/getClass.kt"
|
source = "codegen/inline/getClass.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task inline_statementAsLastExprInBlock(type: RunKonanTest) {
|
||||||
|
goldValue = "OK\n"
|
||||||
|
source = "codegen/inline/statementAsLastExprInBlock.kt"
|
||||||
|
}
|
||||||
|
|
||||||
task deserialized_inline0(type: RunKonanTest) {
|
task deserialized_inline0(type: RunKonanTest) {
|
||||||
source = "serialization/deserialized_inline0.kt"
|
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")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user